Stephen P. Compall's patch to fix problems with multipart/form-data request
[hunchentoot.git] / conditions.lisp
bloba4f7b6a0b3f55d08825cc00870c938518861c845
1 ;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: HUNCHENTOOT; Base: 10 -*-
2 ;;; $Header: /usr/local/cvsrep/odd-streams/conditions.lisp,v 1.5 2007/12/31 01:08:45 edi Exp $
4 ;;; Copyright (c) 2008-2009, Dr. Edmund Weitz. All rights reserved.
6 ;;; Redistribution and use in source and binary forms, with or without
7 ;;; modification, are permitted provided that the following conditions
8 ;;; are met:
10 ;;; * Redistributions of source code must retain the above copyright
11 ;;; notice, this list of conditions and the following disclaimer.
13 ;;; * Redistributions in binary form must reproduce the above
14 ;;; copyright notice, this list of conditions and the following
15 ;;; disclaimer in the documentation and/or other materials
16 ;;; provided with the distribution.
18 ;;; THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESSED
19 ;;; OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20 ;;; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 ;;; ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
22 ;;; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 ;;; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
24 ;;; GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 ;;; INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
26 ;;; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
27 ;;; NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28 ;;; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 (in-package :hunchentoot)
32 (define-condition hunchentoot-condition (condition)
34 (:documentation "Superclass for all conditions related to Hunchentoot."))
36 (define-condition hunchentoot-error (hunchentoot-condition error)
38 (:documentation "Superclass for all errors related to Hunchentoot."))
40 (define-condition hunchentoot-simple-error (hunchentoot-error simple-condition)
42 (:documentation "Like HUNCHENTOOT-ERROR but with formatting capabilities."))
44 (defun hunchentoot-error (format-control &rest format-arguments)
45 "Signals an error of type HUNCHENTOOT-SIMPLE-ERROR with the provided
46 format control and arguments."
47 (error 'hunchentoot-simple-error
48 :format-control format-control
49 :format-arguments format-arguments))
51 (define-condition hunchentoot-warning (hunchentoot-condition warning)
53 (:documentation "Superclass for all warnings related to Hunchentoot."))
55 (define-condition hunchentoot-simple-warning (hunchentoot-warning simple-condition)
57 (:documentation "Like HUNCHENTOOT-WARNING but with formatting capabilities."))
59 (defun hunchentoot-warn (format-control &rest format-arguments)
60 "Signals a warning of type HUNCHENTOOT-SIMPLE-WARNING with the
61 provided format control and arguments."
62 (warn 'hunchentoot-simple-warning
63 :format-control format-control
64 :format-arguments format-arguments))
66 (define-condition parameter-error (hunchentoot-simple-error)
68 (:documentation "Signalled if a function was called with incosistent or illegal parameters."))
70 (defun parameter-error (format-control &rest format-arguments)
71 "Signals an error of type PARAMETER-ERROR with the provided
72 format control and arguments."
73 (error 'parameter-error
74 :format-control format-control
75 :format-arguments format-arguments))
77 (define-condition operation-not-implemented (hunchentoot-error)
78 ((operation :initarg :operation
79 :reader hunchentoot-operation-not-implemented-operation
80 :documentation "The name of the unimplemented operation."))
81 (:report (lambda (condition stream)
82 (format stream "The operation ~A is not yet implemented for the implementation ~A.
83 Consider sending a patch..."
84 (hunchentoot-operation-not-implemented-operation condition)
85 (lisp-implementation-type))))
86 (:documentation "This warning is signalled when an operation \(like
87 SETUID for example) is not implemented for a specific Lisp."))
89 (defun not-implemented (name)
90 "Used to signal an error if an operation named NAME is not implemented."
91 (error 'operation-not-implemented :operation name))