Skip to content

Commit

Permalink
Added guard clause for seting readstream position, when not changed. (#…
Browse files Browse the repository at this point in the history
…615)

- fixes #614
  • Loading branch information
Bajger authored Mar 18, 2024
1 parent 54d85b7 commit ee92563
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions dev/src/ExercismTools/TonelParser.extension.st
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,16 @@ TonelParser >> documentFrom: aString [
self stream: aString readStream.
^self document
]

{ #category : #'*ExercismTools' }
TonelParser >> try: aBlock onSuccess: successBlock onFailure: failureBlock [
| pos |

pos := stream position.
[ ^ successBlock value: aBlock value ]
on: TonelParseError
do: [ :e |
stream position > pos ifTrue: [stream position: pos].
^ failureBlock value ].

]

0 comments on commit ee92563

Please sign in to comment.