Enhance the Augeas.Error exception
[ocaml-augeas.git] / augeas.ml
index f556df0..ba3626e 100644 (file)
--- a/augeas.ml
+++ b/augeas.ml
@@ -20,8 +20,6 @@
 
 type t
 
-exception Error of string
-
 type flag =
   | AugSaveBackup
   | AugSaveNewFile
@@ -30,6 +28,24 @@ type flag =
   | AugSaveNoop
   | AugNoLoad
 
+type error_code =
+  | AugErrInternal
+  | AugErrPathX
+  | AugErrNoMatch
+  | AugErrMMatch
+  | AugErrSyntax
+  | AugErrNoLens
+  | AugErrMXfm
+  | AugErrNoSpan
+  | AugErrMvDesc
+  | AugErrCmdRun
+  | AugErrBadArg
+  | AugErrLabel
+  | AugErrCpDesc
+  | AugErrUnknown of int
+
+exception Error of error_code * string * string * string
+
 type path = string
 
 type value = string
@@ -56,4 +72,4 @@ external load : t -> unit
   = "ocaml_augeas_load"
 
 let () =
-  Callback.register_exception "Augeas.Error" (Error "")
+  Callback.register_exception "Augeas.Error" (Error (AugErrInternal, "", "", ""))