1 ;;;; -*- Mode: Lisp; indent-tabs-mode: nil -*-
3 ;;; --- Error conditions.
6 (in-package :iolib.zstreams
)
8 (define-condition posix-file-error
(file-error)
9 ((action :initarg
:action
:reader posix-file-error-action
)
10 (code :initarg
:code
:reader posix-file-error-code
)
11 (identifier :initarg
:identifier
:reader posix-file-error-identifier
))
12 (:report
(lambda (condition stream
)
13 (format stream
"Error while ~A ~S: ~A"
14 (posix-file-error-action condition
)
15 (file-error-pathname condition
)
16 (isys:strerror
(posix-file-error-code condition
))))))
18 (defun posix-file-error (syscall-error filename action
)
19 (error 'posix-file-error
20 :code
(posix-file-error-code syscall-error
)
21 :identifier
(posix-file-error-identifier syscall-error
)
22 :pathname filename
:action action
))
24 (define-condition hangup
(stream-error) ()
25 (:report
(lambda (c s
)
26 (format s
"Stream ~S hang up."
27 (stream-error-stream c
))))
28 (:documentation
"Condition signaled when the underlying device of a stream
29 is closed by the remote end while writing to it."))