(line :initarg :line :reader error-line)
(column :initarg :column :reader error-column)
(source :initarg :source :reader error-source)
- (position-unit :initarg :position-unit :initform :character :reader error-position-unit))
+ (position-unit :initarg :position-unit :initform :character :reader error-position-unit)
+ (context :initarg :context :initform nil :reader error-context))
(:report (lambda (condition stream)
(format stream "~A~@[ in ~A~] at ~A ~D~@[ (line ~D~]~@[, column ~D)~]: ~A"
(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) ())
+(define-condition undefined-template (template-error) ())
+(define-condition template-arity-error (template-error) ())
+(define-condition unbound-template-variable (template-error) ())
+(define-condition invalid-template-argument (template-error) ())
+(define-condition invalid-template-body (template-error) ())
+(defvar *template-context* nil)
(defvar *source-name* nil)
(defvar *source-text* "")
(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)))
+ :column column :source *source-name* :position-unit unit :context (copy-tree (append *template-context* *resource-context*)))))