From d909a9590d649ff422c00604ef3a468c98b83344 Mon Sep 17 00:00:00 2001 From: Jay McCarthy Date: Mon, 2 Jun 2014 06:30:23 -0600 Subject: [PATCH] Adding things to unstable/error that are painful to remember and used everywhere --- .../unstable-doc/scribblings/error.scrbl | 6 ++++++ racket/collects/unstable/error.rkt | 17 +++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/pkgs/unstable-pkgs/unstable-doc/scribblings/error.scrbl b/pkgs/unstable-pkgs/unstable-doc/scribblings/error.scrbl index 35730a8272..fb9e746ab9 100644 --- a/pkgs/unstable-pkgs/unstable-doc/scribblings/error.scrbl +++ b/pkgs/unstable-pkgs/unstable-doc/scribblings/error.scrbl @@ -110,3 +110,9 @@ can be appended to the end of a base error message. } @(close-eval the-eval) + +@addition{Jay McCarthy} + +@defproc[(exn:not-break? [x any/c]) boolean?]{Identifies values that are not @racket[exn:break?], i.e. values that are safe to catch with @racket[with-handlers].} + +@defproc[(error-display [x any/c]) void?]{Calls @racket[(error-display-handler)] with the proper arguments whehter @racket[x] is an exception, or not.} diff --git a/racket/collects/unstable/error.rkt b/racket/collects/unstable/error.rkt index e50313280f..07c76edfa7 100644 --- a/racket/collects/unstable/error.rkt +++ b/racket/collects/unstable/error.rkt @@ -181,3 +181,20 @@ TODO [value (cadr lst)]) (cons (cons field value) (field+detail-list->table who (cddr lst) onto)))])) + +;; Added by Jay + +(define (exn:not-break? x) + (not (exn:break? x))) + +(define (error-display x) + ((error-display-handler) + (if (exn? x) + (exn-message x) + "non-exn error:") + x)) + +(provide + (contract-out + [exn:not-break? (-> any/c boolean?)] + [error-display (-> any/c void?)]))