Skip to content

Commit eb3b7c1

Browse files
committed
FIX: HELP was providing invalid info if value of path was of ERROR! type
fixes: metaeducation/rebol-issues#2308 With this modification it works like: ``` >> help foo No information on foo >> help foo/boo No information on foo/boo (path has no value) >> help system/foo There is no foo in path system/foo >> ? system/state/last-error SYSTEM/STATE/LAST-ERROR is a none of value: none >> 1 / 0 ** Math error: attempt to divide by zero ** Where: / ** Near: / 0 >> ? system/state/last-error SYSTEM/STATE/LAST-ERROR is an error of value: make error! [ code: 400 type: 'Math id: 'zero-divide arg1: none arg2: none arg3: none near: [/ 0] where: [/] ] ```
1 parent eea7372 commit eb3b7c1

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

src/mezz/mezz-help.r

+16-6
Original file line numberDiff line numberDiff line change
@@ -238,12 +238,22 @@ dump-obj: function [
238238

239239
; Get value (may be a function, so handle with ":")
240240
either path? :word [
241-
if any [
242-
error? set/any 'value try [get :word] ;try reduce [to-get-path word]
243-
not value? 'value
244-
][
245-
print ["No information on" word "(path has no value)"]
246-
exit
241+
if error? set/any 'value try [get :word][
242+
;check if value is error or if it was really an invalid or path without value
243+
if all [
244+
value/id = 'invalid-path
245+
value/arg1 = :word
246+
][
247+
print ["There is no" value/arg2 "in path" value/arg1]
248+
exit
249+
]
250+
if all [
251+
value/id = 'no-value
252+
value/arg1 = first :word
253+
][
254+
print ["No information on" word "(path has no value)"]
255+
exit
256+
]
247257
]
248258
][
249259
value: get :word

0 commit comments

Comments
 (0)