Changeset 6635
- Timestamp:
- May 31, 2007, 5:39:26 PM (17 years ago)
- File:
-
- 1 edited
-
trunk/ccl/level-1/l1-error-system.lisp (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ccl/level-1/l1-error-system.lisp
r6273 r6635 337 337 (define-condition stream-error (error) 338 338 ((stream :initarg :stream :reader stream-error-stream))) 339 340 (defun stream-error-context (condition) 341 (let* ((stream (stream-error-stream condition))) 342 (with-output-to-string (s) 343 (format s "on steam ~s" stream) 344 (let* ((pos (ignore-errors (stream-position stream)))) 345 (when pos 346 (format s ", near position ~d" pos))) 347 (let* ((surrounding (stream-surrounding-characters stream))) 348 (when surrounding 349 (format s ", within ~s" surrounding)))))) 350 339 351 (define-condition parse-error (error) ()) 340 352 (define-condition parse-integer-not-integer-string (parse-error) … … 346 358 (define-condition end-of-file (stream-error) () 347 359 (:report (lambda (c s) 348 (format s "Unexpected end of file on ~s" (stream-error-streamc)))))360 (format s "Unexpected end of file ~s" (stream-error-context c))))) 349 361 (define-condition impossible-number (reader-error) 350 362 ((token :initarg :token :reader impossible-number-token) 351 363 (condition :initarg :condition :reader impossible-number-condition)) 352 364 (:report (lambda (c s) 353 (format s "Condition of type ~s raised ~&while trying to parse numeric token ~s ~& on~s"365 (format s "Condition of type ~s raised ~&while trying to parse numeric token ~s ~&~s" 354 366 (type-of (impossible-number-condition c)) 355 367 (impossible-number-token c) 356 (stream-error- streamc)))))368 (stream-error-context c))))) 357 369 358 370 … … 360 372 (define-condition simple-stream-error (stream-error simple-condition) () 361 373 (:report (lambda (c s) 362 (format s "Error on ~s : ~&~a" (stream-error-streamc)374 (format s "Error ~s : ~&~a" (stream-error-context c) 363 375 (apply #'format 364 376 nil … … 367 379 368 380 369 (define-condition modify-read-only-buffer (error) () 370 (:report (lambda (c s) 371 (declare (ignore c)) 372 (format s "Cannot modify a read-only buffer")))) 381 373 382 374 383 (define-condition file-error (error)
Note:
See TracChangeset
for help on using the changeset viewer.
