feat: defined errors
This commit is contained in:
parent
15911d6e49
commit
56ce72e492
3 changed files with 27 additions and 2 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
|
@ -1,3 +1,5 @@
|
|||
*.swp
|
||||
|
||||
# ---> CommonLisp
|
||||
*.FASL
|
||||
*.fasl
|
||||
|
|
@ -17,4 +19,4 @@
|
|||
*.wx64fsl
|
||||
*.wx32fsl
|
||||
|
||||
*.mdx
|
||||
*.mdx
|
||||
|
|
|
|||
|
|
@ -1,5 +1,24 @@
|
|||
(in-package :monastery)
|
||||
|
||||
;; conditions
|
||||
|
||||
;;; dict-error is the general interface error, when handling conditions
|
||||
;;; it is the general case to use when catching all signals that may happen
|
||||
(define-condition dict-error (error)
|
||||
(message :initarg :message :reader dict-error-message)
|
||||
(:report
|
||||
(lambda (condition stream)
|
||||
(write-string (dict-error-message condition) stream)))
|
||||
(:documentation "General error interface regarding the dictionary."))
|
||||
|
||||
(define-condition dict-initialization-error (dict-error)
|
||||
()
|
||||
(:documentation "Error regarding the initialization of the dictionary."))
|
||||
|
||||
(define-condition dict-operation-error (dict-error)
|
||||
()
|
||||
(:documentation "Error regarding the operations involving the dictionary."))
|
||||
|
||||
|
||||
;; useful macros
|
||||
(defmacro with-dict ((dict filepath) &body body)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,10 @@
|
|||
(defpackage :monastery
|
||||
(:use #:cl #:cffi #:cffi-ops)
|
||||
(:export #:dict-init #:dict-close #:with-dict))
|
||||
(:export
|
||||
#:dict-init #:dict-close #:with-dict
|
||||
|
||||
#:dict-error #:dict-initialization-error #:dict-operation-error
|
||||
#:dict-error-message))
|
||||
|
||||
|
||||
(in-package :monastery)
|
||||
|
|
|
|||
Loading…
Reference in a new issue