Skip to content

Commit 6c7fd45

Browse files
committed
CHANGE: allow making error using error as a make's type
related to: Oldes/Rebol-issues#993
1 parent 8892f7d commit 6c7fd45

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

src/core/t-object.c

+5
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,11 @@ static REBSER *Trim_Object(REBSER *obj)
396396
break; // returns obj
397397
}
398398
}
399+
else if (IS_ERROR(value)) {
400+
Make_Error_Object(arg, value); // arg is block/string, returns value
401+
type = 0;
402+
break; // returns value
403+
}
399404
Trap_Make(VAL_TYPE(value), value);
400405

401406
case A_TO:

src/tests/units/error-test.r3

+6
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@ Rebol [
2424
e/type = 'Math
2525
e/id = 'overflow
2626
]
27+
;@@ https://github.com/Oldes/Rebol-issues/issues/993
28+
--assert all [
29+
error? e: make e "message"
30+
e/type = 'User
31+
e/arg1 = "message"
32+
]
2733

2834
--test-- "make invalid error!"
2935
;@@ https://github.com/Oldes/Rebol-issues/issues/1002

0 commit comments

Comments
 (0)