Permalink
Browse files

v1.3.17 - introduce allegroserve-error condition object

In order to add program recovery from errors detected by AllegroServe
we've introduced an allegroserve-error object which we'll begin
using in place of a generic lisp error.  Initially we're using
it in the client code to signal a timed out connection.

A documentation update will be filed.

This is a response to spr39616

Change-Id: I780e86f4e0521dc5a86bb7c4621e9810155e0e6c
  • Loading branch information...
1 parent d54c146 commit e5acce3df3d755a06651a81d6ca9b5134b2ea34c John Foderaro committed Oct 3, 2012
Showing with 32 additions and 4 deletions.
  1. +6 −2 client.cl
  2. +21 −1 macs.cl
  3. +1 −1 main.cl
  4. +4 −0 packages.cl
View
@@ -643,8 +643,12 @@
;; to wrap around a call to make-socket
;;
`(mp:with-timeout ((or ,timeout 99999999)
- (error "Connecting to host ~a port ~a timed out after ~s seconds"
- ,host ,port ,timeout))
+ (error 'allegroserve-error
+ :action (format nil "connecting to a socket at ~s:~s"
+ ,host ,port)
+ :result (format nil "exceeded timeout of ~s seconds"
+ ,timeout)
+ :identifier :connect-timeout))
,@body))
View
22 macs.cl
@@ -320,4 +320,24 @@
;;;;;; end of smp-aware macro definitions
-
+(define-condition allegroserve-error (error)
+ (;; what was being attempted with the error occured
+ (action :initarg :action :reader allegroserve-error-action
+ :initform "unspecified")
+
+ ;; describing the result that is considered an error
+ (result :initarg :result :reader allegroserve-error-result
+ :initform "unspecified")
+
+ ; a keyword unique to each error
+ (identifier :initarg :identifier :reader allegroserve-error-identifier
+ :initform nil))
+ (:report
+ (lambda (con stream)
+ (with-slots (action result identifier) con
+ (format stream
+ "~@<~a resulted in error ~s : ~a.~:@>"
+ action
+ identifier
+ result)))))
+
View
@@ -38,7 +38,7 @@
#+ignore
(check-smp-consistency)
-(defparameter *aserve-version* '(1 3 16))
+(defparameter *aserve-version* '(1 3 17))
(eval-when (eval load)
(require :sock)
View
@@ -111,6 +111,10 @@ without compression. Original error loading deflate was:~:@>~%~a~%" c)
(defpackage :net.aserve
(:use :common-lisp :excl :net.html.generator :net.uri :util.zip)
(:export
+ #:allegroserve-error
+ #:allegroserve-error-action
+ #:allegroserve-error-result
+ #:allegroserve-error-identifier
#:authorize
#:authorizer
#:base64-decode

0 comments on commit e5acce3

Please sign in to comment.