smalltalk: Exception/on:do:/ensure:/ifCurtailed: + 15 tests
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Has been cancelled
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Has been cancelled
This commit is contained in:
@@ -391,6 +391,17 @@
|
||||
(st-parse-method "selector: aSym selector := aSym"))
|
||||
(st-class-add-method! "Message" "arguments:"
|
||||
(st-parse-method "arguments: anArray arguments := anArray"))
|
||||
;; Exception hierarchy — Smalltalk's standard error system on top of
|
||||
;; SX's `guard`/`raise`. Subclassing Exception gives you on:do:,
|
||||
;; ensure:, ifCurtailed: catching out of the box.
|
||||
(st-class-define! "Exception" "Object" (list "messageText"))
|
||||
(st-class-add-method! "Exception" "messageText"
|
||||
(st-parse-method "messageText ^ messageText"))
|
||||
(st-class-add-method! "Exception" "messageText:"
|
||||
(st-parse-method "messageText: aString messageText := aString. ^ self"))
|
||||
(st-class-define! "Error" "Exception" (list))
|
||||
(st-class-define! "ZeroDivide" "Error" (list))
|
||||
(st-class-define! "MessageNotUnderstood" "Error" (list))
|
||||
"ok")))
|
||||
|
||||
;; Initialise on load. Tests can re-bootstrap to reset state.
|
||||
|
||||
Reference in New Issue
Block a user