Skip to content

Commit

Permalink
There has been a regression as the same exception is not returning to…
Browse files Browse the repository at this point in the history
… the correct singalling context when resuming.

- Returning to previous change introduced in #10429
- Fix #10651
- Adding Tests
  • Loading branch information
tesonep committed Dec 13, 2021
1 parent 0af3506 commit 972fd92
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
21 changes: 21 additions & 0 deletions src/Kernel-Tests/ExceptionTest.class.st
Expand Up @@ -30,6 +30,14 @@ ExceptionTest >> assertSuccess: anExceptionTester [
self should: [ ( anExceptionTester suiteLog first) endsWith: 'succeeded'].
]

{ #category : #utilities }
ExceptionTest >> methodSignallingZeroDivide [

^ [ 1 / 0 ]
on: ZeroDivide
do: [ :e | e signal ]
]

{ #category : #private }
ExceptionTest >> runCaseManaged [
"We should disable TestEnvironment to avoid any logic for unhandled errors from background processes.
Expand Down Expand Up @@ -314,6 +322,19 @@ ExceptionTest >> testResignalAsUnwinds [
self assert: answer == 5
]

{ #category : #'tests - resignal' }
ExceptionTest >> testResignalExceptionThatHasBeenSignaledTwice [

| shouldBe17 |
shouldBe17 := nil.

[ shouldBe17 := self methodSignallingZeroDivide ]
on: ZeroDivide
do: [ :e | e resume: 17 ].

self assert: shouldBe17 notNil
]

{ #category : #'tests - exceptiontester' }
ExceptionTest >> testResumableFallOffTheEndHandler [
self assertSuccess: (ExceptionTester new runTest: #resumableFallOffTheEndHandler )
Expand Down
4 changes: 2 additions & 2 deletions src/Kernel/Context.class.st
Expand Up @@ -732,8 +732,8 @@ Context >> evaluateSignal: exception [
| value |
exception privHandlerContext: self contextTag.
value := self exceptionHandlerBlock cull: exception.
"default return if not otherwise directed in handle block"
exception return: value
"return from self if not otherwise directed in handle block"
self return: value
]

{ #category : #'special context access' }
Expand Down

0 comments on commit 972fd92

Please sign in to comment.