From: Sam S. <sd...@gn...> - 2011-08-02 20:35:05
|
Hi, Right now all OS errors are reported as simple-os-errors with a format string and an argument list. This is not good because for automated error recovery one has to parse the error message to distinguish between, say, EPERM and ENOENT. Thus I want to add a $CODE slot to OS-ERROR which would contain the error code (symbolic, converted by check_errno_reverse in the syscalls module). However, once we start keeping the error code slot in the condition object, there is no good reason for os-error to be a simple-error because we can now do (define-condition os-error (error) (($code :initarg :code :reader os-error-code)) (:report (lambda (c s) (let ((code (os-error-code c))) (format s "~S=~S: ~S" code (errno code) (strerror code)))))) where STRERROR returns the message for the code and ERRNO converts between the symbolic and numeric codes. Thus I will remove simple-os-error. Objections? However, while on unix there is only one kind of error (OS-error, errno), windows have two kinds: OS-error (GetLastError) and ANSIC-error (errno). Thus I have 4 options for windows: - make os-error abstract and os-error-ansi & os-error-win32 inherit from it - make os-error mean ansi C errno (like on unix) and os-error-win32 inherit from it - make os-error mean win32 GetLastError error and os-error-ansic inherit from it - make a single os-error class with an extra slot $ANSICP which will tell me whether the code is errno or GetLastError; alternatively, store GetLastError as a negative number. Any preferences? -- Sam Steingold (http://sds.podval.org/) on CentOS release 5.6 (Final) X 11.0.60900031 http://openvotingconsortium.org http://palestinefacts.org http://ffii.org http://camera.org http://www.PetitionOnline.com/tap12009/ http://memri.org Any supplier that makes enough to pay a full time lobbyist is overcharging. |