Skip to content

Commit

Permalink
Display exception info in PolyglotInspector
Browse files Browse the repository at this point in the history
and improve Polyglot class#signalPolyglotError
  • Loading branch information
fniephaus committed Jun 10, 2021
1 parent a766019 commit a913a65
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
helpers
signalPolyglotError
self error: self primitiveLastError
| error |
error := self primitiveLastError.
error inspect.
self error: error asString
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"primitiveIsPolyglotEvalAllowed" : "fn 1/5/2020 16:58",
"primitiveLastError" : "fn 10/2/2019 09:09",
"setUpPolyglotEnvironment" : "fn 1/24/2020 14:41",
"signalPolyglotError" : "fn 4/13/2019 14:08",
"signalPolyglotError" : "fn 6/10/2021 16:15",
"startUp:" : "fn 1/24/2020 14:41" },
"instance" : {
} }
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
helpers
exceptionInfoFor: anInteropException
^ 'Message: {1}
Cause: {2}
Type: {3}
Stack trace:
- {4}' format: {
(Interop hasExceptionMessage: anInteropException)
ifFalse: [ 'n/a' ]
ifTrue: [ Interop getExceptionMessage: anInteropException ].
(Interop hasExceptionCause: anInteropException)
ifFalse: [ 'n/a' ]
ifTrue: [ Interop getExceptionCause: anInteropException ].
Interop getExceptionType: anInteropException.
(Interop hasExceptionStackTrace: anInteropException)
ifFalse: [ 'n/a' ]
ifTrue: [ ((Interop getExceptionStackTrace: anInteropException) asCollection
collect: [ :ea | ((Interop hasExecutableName: ea)
ifTrue: [ (Interop getExecutableName: ea) ]
ifFalse: [ ea ]) asString ]) joinSeparatedBy: String cr, '- ' ] }
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
fields
fieldException

^ (self newFieldForType: #misc key: #exception)
name: 'language info'; emphasizeName;
valueGetter: [ :o | self exceptionInfoFor: o ]; printValueAsIs;
yourself
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ fieldLanguageInfo

^ (self newFieldForType: #misc key: #language)
name: 'language info'; emphasizeName;
valueGetter: [ :o | self getLanguageInfo: o ]; printValueAsIs;
valueGetter: [ :o | self languageInfoFor: o ]; printValueAsIs;
valueGetterExpression: 'Interop getLanguageInfo: self';
yourself
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
helpers
getLanguageInfo: anObject
languageInfoFor: anObject
| info |
info := (Interop getLanguageInfo: anObject).
^ 'Name: {1}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,7 @@ streamOptionalFieldsOn: aStream
aStream nextPut: self fieldLanguageInfo ].
(Interop hasSourceLocation: self object) ifTrue: [
aStream nextPut: self fieldSource ].
(Interop isException: self object) ifTrue: [
aStream nextPut: self fieldException ].
(Interop hasMembers: self object) ifTrue: [
aStream nextPutAll: self fieldsMembers ].
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,22 @@
},
"instance" : {
"aboutToStyle:" : "fn 12/5/2018 19:14",
"fieldLanguageInfo" : "fn 4/11/2021 15:02",
"exceptionInfoFor:" : "fn 6/10/2021 17:15",
"fieldException" : "fn 6/10/2021 16:48",
"fieldLanguageInfo" : "fn 6/10/2021 16:48",
"fieldMetaName" : "fn 4/11/2021 15:02",
"fieldMetaObject" : "fn 4/11/2021 15:01",
"fieldMetaObjectInfo" : "fn 4/11/2021 15:02",
"fieldSource" : "fn 4/11/2021 15:02",
"fieldsMembers" : "fn 4/11/2021 15:02",
"getLanguageInfo:" : "fn 2/12/2021 10:27",
"initialExtent" : "fn 2/12/2021 10:35",
"inspect:" : "fn 11/21/2019 15:47",
"inspectAs:" : "fn 1/26/2021 16:04",
"inspectVMObject" : "fn 3/29/2021 16:40",
"labelString" : "fn 2/11/2021 12:28",
"languageInfoFor:" : "fn 6/10/2021 16:47",
"mainFieldListMenu:" : "fn 3/29/2021 16:39",
"streamArrayElementsOn:" : "fn 4/11/2021 15:03",
"streamBaseFieldsOn:" : "fn 2/11/2021 11:01",
"streamFieldsOn:" : "fn 2/11/2021 11:49",
"streamOptionalFieldsOn:" : "fn 2/19/2021 13:36" } }
"streamOptionalFieldsOn:" : "fn 6/10/2021 16:46" } }

0 comments on commit a913a65

Please sign in to comment.