about summary refs log tree commit diff
path: root/src/error
diff options
context:
space:
mode:
Diffstat (limited to 'src/error')
-rw-r--r--src/error/Error.ml16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/error/Error.ml b/src/error/Error.ml
index 555d41c..9a5ea9e 100644
--- a/src/error/Error.ml
+++ b/src/error/Error.ml
@@ -1,6 +1,7 @@
 module Message =
 struct
   type t =
+    | FileError
     | IllegalCharacter
     | SyntaxError
     | UnboundVariable
@@ -10,6 +11,7 @@ struct
 
   let default_severity : t -> Asai.Diagnostic.severity =
     function
+    | FileError -> Error
     | IllegalCharacter -> Error
     | SyntaxError -> Error
     | UnboundVariable -> Error
@@ -19,19 +21,23 @@ struct
 
   let short_code : t -> string =
     function
+    (* operating system errors *)
+    | FileError -> "E101"
     (* parser errors *)
-    | IllegalCharacter -> "E101"
-    | SyntaxError -> "E102"
+    | IllegalCharacter -> "E201"
+    | SyntaxError -> "E202"
     (* elaboration errors *)
-    | UnboundVariable -> "E201"
-    | TypeMismatch -> "E202"
-    | NotInferable -> "E203"
+    | UnboundVariable -> "E301"
+    | TypeMismatch -> "E302"
+    | NotInferable -> "E303"
     (* misc *)
     | Bug -> "E900"
 end
 
 include Asai.Reporter.Make(Message)
 
+let file_open_error ~path ~msg = fatalf FileError
+    "unable to open file '%s': %s" path msg
 let illegal_character ~loc char = fatalf ~loc IllegalCharacter
     "illegal character '%s'" (Char.escaped char)
 let syntax_error ~loc = fatalf ~loc SyntaxError