forked from zhef/cl-eshop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patherrors.lisp
41 lines (30 loc) · 1.5 KB
/
errors.lisp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
;;;; errors.lisp
;;;;
;;;; This file is part of the cl-eshop project, released under GNU Affero General Public License, Version 3.0
;;;; See file COPYING for details.
;;;;
;;;; Author: Glukhov Michail aka Rigidus <[email protected]>
(in-package #:eshop)
(define-condition wrong-product-slot-value (error)
((text :initarg :text :accessor text)
(value :initarg :value :accessor value)
(product :initarg :product :accessor product))
(:report (lambda (condition stream)
(format stream "Incorrect value of product slot ~a ~%[value: '~a']~%[type '~a']"
(text condition)
(value condition)
(type-of (value condition))))))
(define-condition wrong-type-of-slot (error) ())
(define-condition wrong-product-file (error)
((filepath :initarg :filepath :accessor filepath)
(in-condition :initarg :in-condition :accessor in-condition))
(:report (lambda (condition stream)
(format stream "Unable unserialize product: ~a ~% Reason: ~a"
(filepath condition)
(format nil "Incorrect value of product slot ~a ~% [value: '~a']~% [type '~a']"
(text (in-condition condition))
(value (in-condition condition))
(type-of (value (in-condition condition))))))))
(defun read-new-integer-value ()
(format t "Enter a new integer value: ")
(multiple-value-list (eval (read))))