1 ;;;; -*- Mode: Lisp; Syntax: ANSI-Common-Lisp; indent-tabs-mode: nil -*-
3 ;;; --- Error conditions.
6 (in-package :io.zeta-streams
)
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 (nix:strerror
(posix-file-error-code condition
))))))
18 (defun posix-file-error (posix-error filename action
)
19 (error 'posix-file-error
20 :code
(osicat-sys:system-error-code posix-error
)
21 :identifier
(osicat-sys:system-error-identifier posix-error
)
22 :pathname filename
:action action
))