aboutsummaryrefslogtreecommitdiff
path: root/src/cljcc/exception.clj
diff options
context:
space:
mode:
Diffstat (limited to 'src/cljcc/exception.clj')
-rw-r--r--src/cljcc/exception.clj12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/cljcc/exception.clj b/src/cljcc/exception.clj
index 20d936b..6eec308 100644
--- a/src/cljcc/exception.clj
+++ b/src/cljcc/exception.clj
@@ -1,7 +1,9 @@
(ns cljcc.exception)
-(defn lex-error [{line :line col :col msg :msg}]
- (let [err-msg (if (empty? msg)
- (format "Lexer error. Invalid token at line: %s, col: %s." line col)
- (format "Lexer error. Invalid token at line: %s, col: %s. %s" line col msg))]
- (throw (ex-info err-msg {}))))
+(defn lex-error [{line :line col :col :as data}]
+ (throw (ex-info
+ (format "Invalid token at line: %s, col: %s." line col)
+ (merge {:error/type :lexer} data))))
+
+(defn parser-error [msg data]
+ (throw (ex-info msg (merge {:error/type :parser} data))))