* Added print-condition procedure which now prints an ugly message.

This commit is contained in:
Abdulaziz Ghuloum 2007-10-24 00:24:38 -04:00
parent 6853d2f750
commit dab2b74189
5 changed files with 25 additions and 16 deletions

Binary file not shown.

View File

@ -26,7 +26,6 @@ description:
(export new-cafe) (export new-cafe)
(import (import
(only (rnrs) with-exception-handler) (only (rnrs) with-exception-handler)
(only (ikarus exceptions) print-condition)
(only (psyntax expander) eval-top-level) (only (psyntax expander) eval-top-level)
(except (ikarus) new-cafe)) (except (ikarus) new-cafe))

View File

@ -1,7 +1,7 @@
(library (ikarus conditions) (library (ikarus conditions)
(export condition? simple-conditions condition-predicate (export condition? simple-conditions condition-predicate
condition condition-accessor condition condition-accessor print-condition
;;; too much junk ;;; too much junk
make-message-condition message-condition? make-message-condition message-condition?
@ -62,6 +62,7 @@
(only (ikarus records procedural) rtd? rtd-subtype?) (only (ikarus records procedural) rtd? rtd-subtype?)
(except (ikarus) define-condition-type condition? simple-conditions (except (ikarus) define-condition-type condition? simple-conditions
condition condition-predicate condition-accessor condition condition-predicate condition-accessor
print-condition
;;; more junk ;;; more junk
make-message-condition message-condition? make-message-condition message-condition?
@ -300,5 +301,19 @@
(define-condition-type &no-nans &implementation-restriction (define-condition-type &no-nans &implementation-restriction
make-no-nans-violation no-nans-violation?) make-no-nans-violation no-nans-violation?)
(define print-condition
(let ()
(define (print-condition x p)
(display "CONDITION: " p)
(write x p)
(newline p))
(case-lambda
[(x)
(print-condition x (console-output-port))]
[(x port)
(if (output-port? port)
(print-condition x port)
(error 'print-condition "~s is not an output port" port))])))
) )

View File

@ -1,7 +1,6 @@
(library (ikarus exceptions) (library (ikarus exceptions)
(export with-exception-handler raise raise-continuable error (export with-exception-handler raise raise-continuable error)
print-condition)
(import (import
(only (rnrs) condition make-non-continuable-violation (only (rnrs) condition make-non-continuable-violation
make-message-condition make-error make-who-condition make-message-condition make-error make-who-condition
@ -9,8 +8,6 @@
(except (ikarus) (except (ikarus)
with-exception-handler raise raise-continuable error)) with-exception-handler raise raise-continuable error))
(define (print-condition x)
(printf "CONDITION: ~s\n" x))
(define handlers (define handlers
(make-parameter (make-parameter
@ -50,16 +47,13 @@
(unless (string? msg) (unless (string? msg)
(error 'error "message ~s is not a string" msg)) (error 'error "message ~s is not a string" msg))
(raise (raise
(if who (condition
(condition (make-error)
(make-error) (if who (make-who-condition who) (condition))
(make-who-condition who) (make-message-condition msg)
(make-message-condition msg) (if (null? irritants)
(make-irritants-condition irritants)) (condition)
(condition (make-irritants-condition irritants)))))
(make-error)
(make-message-condition msg)
(make-irritants-condition irritants)))))
) )

View File

@ -893,6 +893,7 @@
[utf8->string i r bv] [utf8->string i r bv]
[utf16->string r bv] [utf16->string r bv]
[utf32->string r bv] [utf32->string r bv]
[print-condition i]
[condition? r co] [condition? r co]
[&assertion r co] [&assertion r co]
[assertion-violation? r co] [assertion-violation? r co]