Skip to content

Commit

Permalink
Better error loggin
Browse files Browse the repository at this point in the history
  • Loading branch information
jecisc committed Jul 7, 2022
1 parent da5de3a commit df14236
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/TinyLogger-Tests/TinyLoggerTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ TinyLoggerTest >> testExecuteRecordedAsKeepRightIndentation [
"Ensure we have the right indentation."
self assert: errorDetected.
self assert: contents withUnixLineEndings equals: 'No time : Begin: This is a new test
No time : End with error: This is a new test.Error message: test
No time : End with error: This is a new test.Error message: "Error: test"
No time : Begin: This is a new test
No time : test
No time : End: This is a new test
Expand Down
4 changes: 2 additions & 2 deletions src/TinyLogger/TinyLogger.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -194,12 +194,12 @@ TinyLogger >> execute: aBlock recordedAs: aString [
[ result := aBlock cull: aString ]
on: Error
do: [ :exception | "If there is an error, we keep the message and pass it. The message will be used in the #ifCurtailed: to ensure we keep the right indentation and print a better result to the user."
errorMessage := exception messageText.
errorMessage := exception printString.
exception pass ] ] ifCurtailed: [ "If there is an unexpected termination of the execution, print that there was an error."
self decreaseDepthLevel.
self record: 'End with error: ' , aString , '.' , (errorMessage
ifNil: [ '' ]
ifNotNil: [ 'Error message: ' , errorMessage ]).
ifNotNil: [ 'Error message: "' , errorMessage , '"' ]).
self decreaseDepthLevel ].

self decreaseDepthLevel.
Expand Down

0 comments on commit df14236

Please sign in to comment.