]> dreyeck.freedombox.rocks Git - topic-maps.git/blob - src/xtm/package.lisp
docs: design draft for a read-only SHOP3 adapter over TMDM objects
[topic-maps.git] / src / xtm / package.lisp
1 (defpackage #:topic-maps.xtm
2 (:use #:cl)
3 (:export #:deserialize-octets
4 #:xtm-error #:xtm-rejection #:xtm-unsupported #:xtm-xml-error #:xtm-resource-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)
8
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)))
24
25 (define-condition xtm-resource-error (xtm-error)
26 ((cause :initarg :cause :initform nil :reader error-cause)))
27
28 (defvar *document-iri*)
29 (defvar *source-key*)
30 (defun reject (code detail &optional node (class 'xtm-rejection))
31 (error class :code code :detail detail :document-iri *document-iri*
32 :source-key *source-key* :line (when node (node-line node))
33 :column (when node (node-column node))))