In sbcl I can handle errors as I do here when opening a nonexistent file:
(require "SB-POSIX")
(let* (fd)
(handler-case
(setf fd (sb-posix:open "w" sb-posix:o-rdonly))
(sb-posix:syscall-error (c)
(princ "error ")
(princ (sb-posix:syscall-errno c))
(princ " during ")
(princ (sb-posix:syscall-name c))
(terpri))))
error 2 during OPEN-WITHOUT-MODE
If I don't catch the error, the top part of the result looks like this:
(require "SB-POSIX")
(let* (fd)
(setf fd (sb-posix:open "w" sb-posix:o-rdonly)))
Unhandled SB-POSIX:SYSCALL-ERROR:
Error in SB-POSIX::OPEN-WITHOUT-MODE: No such file or directory (2)
Backtrace for: #<SB-THREAD:THREAD "main thread" RUNNING {1001976AB3}>
See that "No such file or directory" in there? Is there a way my code can have access to that string, so my error handler can say something a little less dorky than "error 2"?
(sb-int:strerror errno)
seems to be how the conditions report function gets it. – jkiiski