feat: defined errors

This commit is contained in:
noether 2026-07-16 20:26:22 -03:00
commit 56ce72e492
3 changed files with 27 additions and 2 deletions

4
.gitignore vendored
View file

@ -1,3 +1,5 @@
*.swp
# ---> CommonLisp
*.FASL
*.fasl
@ -17,4 +19,4 @@
*.wx64fsl
*.wx32fsl
*.mdx
*.mdx

View file

@ -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)

View file

@ -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)