]> dreyeck.freedombox.rocks Git - topic-maps.git/blobdiff - src/ctm/conditions.lisp
Implement CTM Include and source-preserving template import
[topic-maps.git] / src / ctm / conditions.lisp
index 86082b6dcaafc127ca2947cb53ab0218f30ea9ea..2f1842f2127c8f6ecbcf62f20d0e73ba977a779b 100644 (file)
                      (error-code condition) (error-source condition)
                      (error-position-unit condition) (error-position condition)
                      (error-line condition) (error-column condition)
-                     (error-message condition)))))
+                     (error-message condition))
+             (dolist (frame (reverse (error-context condition)))
+               (when (member (getf frame :purpose) '(:mergemap :include))
+                 (format stream "~%  via %~(~A~) in ~A at character ~D -> ~A~@[ (source ~A)~]"
+                         (getf frame :purpose)
+                         (or (getf frame :source) (getf frame :document-iri)) (getf frame :position)
+                         (getf frame :resource-iri) (getf frame :resource-source)))))))
 (define-condition ctm-rejection (ctm-error) ())
 (define-condition undefined-prefix (ctm-rejection) ())
 (define-condition prefix-collision (ctm-rejection) ())
 (define-condition ctm-unsupported (ctm-error) ())
+;; Retrieval/configuration failures are not evidence of malformed CTM.
+(define-condition ctm-resource-error (ctm-error) ())
+(defvar *resource-context* nil)
 
 (define-condition template-error (ctm-rejection) ())
 (define-condition duplicate-template (template-error) ())
@@ -41,4 +50,4 @@
                (setf column 1 previous-cr nil))
               (t (incf column) (setf previous-cr nil)))))
     (error type :code code :message message :position position :line line
-                :column column :source *source-name* :position-unit unit :context (copy-tree *template-context*))))
+                :column column :source *source-name* :position-unit unit :context (copy-tree (append *template-context* *resource-context*)))))