File tree 2 files changed +13
-1
lines changed
2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -356,6 +356,7 @@ static REBOL_STATE Top_State; // Boot var: holds error state during boot
356
356
REBSER * err ; // Error object
357
357
ERROR_OBJ * error ; // Error object values
358
358
REBINT code = 0 ;
359
+ REBVAL * tmp ;
359
360
360
361
// Create a new error object from another object, including any non-standard fields:
361
362
if (IS_ERROR (arg ) || IS_OBJECT (arg )) {
@@ -380,8 +381,14 @@ static REBOL_STATE Top_State; // Boot var: holds error state during boot
380
381
// If user set error code, use it to setup type and id fields.
381
382
if (IS_BLOCK (arg )) {
382
383
DISABLE_GC ;
383
- Do_Bind_Block (err , arg ); // GC-OK (disabled)
384
+ tmp = Do_Bind_Block (err , arg ); // GC-OK (disabled)
384
385
ENABLE_GC ;
386
+ if (THROWN (tmp )) {
387
+ * value = * tmp ;
388
+ return ;
389
+ }
390
+
391
+
385
392
//It was possible to set error using code, but that's now ignored!
386
393
//@@ https://github.com/Oldes/Rebol-issues/issues/1593
387
394
//if (IS_INTEGER(&error->code) && VAL_INT64(&error->code)) {
Original file line number Diff line number Diff line change @@ -799,6 +799,11 @@ Rebol [
799
799
--assert 1 = catch /all [a: 0 catch /name [++ a throw /name 1 'foo] 'bar a: a * 10 ]
800
800
--assert 1 = a
801
801
802
+ --test-- "throw from make error!"
803
+ ;@@ https://github.com/Oldes/Rebol-issues/issues/2244
804
+ --assert error? catch [make error! [type: 'Access arg1: 10 + 20 id: 'Protocol]]
805
+ --assert 30 = catch [make error! [type: 'Access arg1: throw 10 + 20 id: 'Protocol]]
806
+
802
807
===end-group===
803
808
804
809
You can’t perform that action at this time.
0 commit comments