X-Git-Url: http://git.kpe.io/?p=clsql.git;a=blobdiff_plain;f=base%2Fconditions.lisp;h=138aa58fac6ddbdde4182d8a30f7b8b89ac79f08;hp=d1280dc7908e30fd8344b74641fdb99888aac8a2;hb=ce0e343835a040406678dff74a62d1b0cb56f317;hpb=fa071351835a2c754895cb917db9c63303e7b5c1 diff --git a/base/conditions.lisp b/base/conditions.lisp index d1280dc..138aa58 100644 --- a/base/conditions.lisp +++ b/base/conditions.lisp @@ -2,15 +2,15 @@ ;;;; ************************************************************************* ;;;; FILE IDENTIFICATION ;;;; -;;;; Name: conditions.cl +;;;; Name: conditions.lisp ;;;; Purpose: Error conditions for high-level SQL interface ;;;; Programmers: Kevin M. Rosenberg based on ;;;; Original code by Pierre R. Mai ;;;; Date Started: Feb 2002 ;;;; -;;;; $Id: conditions.lisp,v 1.2 2002/10/21 07:45:50 kevin Exp $ +;;;; $Id$ ;;;; -;;;; This file, part of CLSQL, is Copyright (c) 2002 by Kevin M. Rosenberg +;;;; This file, part of CLSQL, is Copyright (c) 2002-2004 by Kevin M. Rosenberg ;;;; and Copyright (c) 1999-2001 by Pierre R. Mai ;;;; ;;;; CLSQL users are granted the rights to distribute and use this software @@ -18,8 +18,7 @@ ;;;; (http://opensource.franz.com/preamble.html), also known as the LLGPL. ;;;; ************************************************************************* -(declaim (optimize (debug 3) (speed 3) (safety 1) (compilation-speed 0))) -(in-package :clsql-base-sys) +(in-package #:clsql-base-sys) ;;; Conditions (define-condition clsql-condition () @@ -157,3 +156,29 @@ and signal an clsql-invalid-spec-error if they don't match." 'clsql-nodb-error :database database)) +(defun signal-no-database-error () + (cerror "Ignore this error and return nil." + 'clsql-nodb-error)) + +;; for USQL support + +(define-condition clsql-type-error (clsql-error clsql-condition) + ((slotname :initarg :slotname + :reader clsql-type-error-slotname) + (typespec :initarg :typespec + :reader clsql-type-error-typespec) + (value :initarg :value + :reader clsql-type-error-value)) + (:report (lambda (c stream) + (format stream + "Invalid value ~A in slot ~A, not of type ~A." + (clsql-type-error-value c) + (clsql-type-error-slotname c) + (clsql-type-error-typespec c))))) + +(define-condition clsql-sql-syntax-error (clsql-error) + ((reason :initarg :reason + :reader clsql-sql-syntax-error-reason)) + (:report (lambda (c stream) + (format stream "Invalid SQL syntax: ~A" + (clsql-sql-syntax-error-reason c)))))