1 (defpackage #:topic-maps.xtm
3 (:export #:deserialize-octets
4 #:xtm-error #:xtm-rejection #:xtm-unsupported #:xtm-xml-error
5 #:error-code #:error-detail #:error-document-iri #:error-source-key
6 #:error-line #:error-column #:error-cause))
7 (in-package #:topic-maps.xtm)
9 (define-condition xtm-error (error)
10 ((code :initarg :code :reader error-code)
11 (detail :initarg :detail :reader error-detail)
12 (document-iri :initarg :document-iri :reader error-document-iri)
13 (source-key :initarg :source-key :reader error-source-key)
14 (line :initarg :line :initform nil :reader error-line)
15 (column :initarg :column :initform nil :reader error-column))
16 (:report (lambda (c out)
17 (format out "XTM ~A at ~A (~A), approximately ~A:~A: ~A"
18 (error-code c) (error-source-key c) (error-document-iri c)
19 (error-line c) (error-column c) (error-detail c)))))
20 (define-condition xtm-rejection (xtm-error) ())
21 (define-condition xtm-unsupported (xtm-error) ())
22 (define-condition xtm-xml-error (xtm-error)
23 ((cause :initarg :cause :reader error-cause)))
25 (defvar *document-iri*)
27 (defun reject (code detail &optional node (class 'xtm-rejection))
28 (error class :code code :detail detail :document-iri *document-iri*
29 :source-key *source-key* :line (when node (node-line node))
30 :column (when node (node-column node))))