The Trunk: Kernel-tonyg.1212.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: Kernel-tonyg.1212.mcz

commits-2
Tony Garnock-Jones uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-tonyg.1212.mcz

==================== Summary ====================

Name: Kernel-tonyg.1212
Author: tonyg
Time: 30 January 2019, 5:20:04.609071 pm
UUID: 03bd0e4c-76d2-4be6-a7e1-58414c7fab52
Ancestors: Kernel-mt.1211

Improve promise resolution error handling via #fulfillWith:.

=============== Diff against Kernel-mt.1211 ===============

Item was added:
+ ----- Method: Promise>>fulfillWith: (in category 'resolving') -----
+ fulfillWith: aBlock
+ self fulfillWith: aBlock passErrors: rejecters isEmpty!

Item was added:
+ ----- Method: Promise>>fulfillWith:passErrors: (in category 'resolving') -----
+ fulfillWith: aBlock passErrors: aBoolean
+ "Evaluate aBlock. If it signals an exception, reject this promise with the exception
+ as the argument; if it returns a value [or another Promise], resolve this promise
+ with the result.
+
+ If aBoolean is true, and an exception is signaled, it is passed out to the caller.
+ If aBoolean is false, signaled exceptions are considered handled after the promise
+ has been rejected."
+ [ self resolveWith: aBlock value ]
+ on: Exception
+ do: [ :ex |
+ (ex isKindOf: Halt)
+ ifTrue: [ex pass]
+ ifFalse: [
+ self rejectWith: ex.
+ aBoolean ifTrue: [ ex pass ] ]]!