>From the docs for raise-result-error:

"Like raise-argument-error
<http://docs.racket-lang.org/reference/exns.html?q=rename-file#%28def._%28%28quote._%7E23%7E25kernel%29._raise-argument-error%29%29>,
but the error message describe v as a “result” instead of an “argument.”"

Testing:

-> (raise-result-error 'funcname "msg" 'x)
; funcname: contract violation
;   expected: msg
;   received: 'x
; [,bt for context]

-> (raise-argument-error 'funcname "msg" 'x)
; funcname: contract violation
;   expected: msg
;   given: 'x
; [,bt for context]

These seem identical.  What am I missing?


More generally, if I want to raise an exception inside a function what is
the preferred way to do it? My current approach is:

(struct exn:fail:evil #:super exn:fail)

(define (foo)
  (when (evil-exists?)
     (raise (exn:fail:evil "evil exists!" (current-continuation-marks))))

Is there a better solution?

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to