forked from pharo-project/pharo
/
StDebuggerErrorContextPredicate.class.st
89 lines (70 loc) · 2.34 KB
/
StDebuggerErrorContextPredicate.class.st
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
"
I provide a specialized context description in the case where an exception was found on the stack of the context.
I reference that exception.
"
Class {
#name : #StDebuggerErrorContextPredicate,
#superclass : #StDebuggerContextPredicate,
#instVars : [
'exception'
],
#category : #'NewTools-Debugger-Model'
}
{ #category : #accessing }
StDebuggerErrorContextPredicate >> assertEqualsSelectors [
self flag: 'Add the denies... use a pragma?'.
^ #(#assert:equals: #assert:closeTo:precision: #assert:closeTo: #assert:identicalTo: #assertCollection:equals: #assertCollection:hasSameElements:)
"#( #assert:equals: #assert:closeTo:precision:
#assert:closeTo: #assert:identicalTo: #assertCollection:equals:
#assertCollection:hasSameElements: )"
]
{ #category : #testing }
StDebuggerErrorContextPredicate >> contextSignalsException [
^true
]
{ #category : #accessing }
StDebuggerErrorContextPredicate >> exception: anObject [
exception := anObject
]
{ #category : #accessing }
StDebuggerErrorContextPredicate >> exceptionWhiteList [
^ {
Warning.
OupsNullException.
Halt }
]
{ #category : #predicates }
StDebuggerErrorContextPredicate >> isContextDoesNotUnderstand [
^ exception class = MessageNotUnderstood and: [
| message |
message := exception message.
(exception receiver respondsTo: message selector) not and: [
exception signalerContext method methodClass == Object ] ]
]
{ #category : #predicates }
StDebuggerErrorContextPredicate >> isContextMissingClassException [
^ exception class == VariableNotDeclared
]
{ #category : #predicates }
StDebuggerErrorContextPredicate >> isContextSubclassResponsibilityException [
^ exception class == SubclassResponsibility
]
{ #category : #predicates }
StDebuggerErrorContextPredicate >> isSteppable [
super isSteppable ifFalse: [ ^ false ].
exception class = MessageNotUnderstood ifTrue: [
^ self isContextDoesNotUnderstand not and: [
self isContextMissingClassException not ] ].
^ self exceptionWhiteList anySatisfy: [ :class |
exception isKindOf: class ]
]
{ #category : #printing }
StDebuggerErrorContextPredicate >> printDescription [
| str |
str := WriteStream on: String new.
self printDescriptionPrefixOn: str.
str << ((exception isKindOf: OupsNullException)
ifTrue: [ context printString ]
ifFalse: [ exception description ]).
^ str contents
]