aboutsummaryrefslogtreecommitdiffstats
path: root/lib/error.ml
diff options
context:
space:
mode:
authorMarcos Magueta <maguetamarcos@gmail.com>2026-04-27 23:29:57 -0300
committerMarcos Magueta <maguetamarcos@gmail.com>2026-04-27 23:29:57 -0300
commit4fdf3392868c72ff4c33b70d165a177e97f2fece (patch)
tree4eebfc260c890ea56d59f874cdfa0c9b1f55cd98 /lib/error.ml
parent97960adb8426e5270fe16b027e82a2c61674f821 (diff)
downloadSakura-4fdf3392868c72ff4c33b70d165a177e97f2fece.tar.gz
Sakura-4fdf3392868c72ff4c33b70d165a177e97f2fece.zip
Format
Diffstat (limited to 'lib/error.ml')
-rw-r--r--lib/error.ml38
1 files changed, 22 insertions, 16 deletions
diff --git a/lib/error.ml b/lib/error.ml
index 09b2e53..cf02845 100644
--- a/lib/error.ml
+++ b/lib/error.ml
@@ -1,4 +1,3 @@
-
(** Error types for manipulation operations *)
type t =
| RelationNotFound of string
@@ -11,26 +10,33 @@ type t =
| MalformedExpression of Sexplib.Sexp.t
(* TODO: think of a better way to manage and serialize sublanguage errors *)
| SublanguageError of Sexplib.Sexp.t
- | Conflict of { old_db : Management.Database.t; new_db : Management.Database.t}
+ | Conflict of {
+ old_db : Management.Database.t;
+ new_db : Management.Database.t;
+ }
| SyntaxError of string
| MultigroupNotFound of string
let sexp_of_error e =
let open Sexplib.Sexp in
let error e ps = List (Atom e :: ps) in
- let (<+>) key value = List [Atom key; value] in
+ let ( <+> ) key value = List [ Atom key; value ] in
match e with
(* TODO: think of a subset of common attributes that every error should have (message, etc)? *)
- | RelationNotFound s -> error "relation-not-found" ["relation" <+> (Atom s)]
- | RelationAlreadyExists s -> error "relation-already-exists" ["relation" <+> (Atom s)]
- | TupleNotFound h -> error "tuple-not-found" ["hash" <+> (Atom h)]
- | DuplicateTuple h -> error "duplicate-tuple" ["hash" <+> (Atom h)]
- | ConstraintViolation s -> error "constraint-violation" ["message" <+> (Atom s)]
- | StorageError s -> error "storage-error" ["message" <+> (Atom s)]
- | UnrecognizedSublanguage s -> error "unrecognized-sublanguage" ["tag" <+> (Atom s)]
- | MalformedExpression s -> error "malformed-expression" ["expression" <+> s]
- | SublanguageError s -> error "sublanguage-error" ["error" <+> s]
- | SyntaxError s -> error "syntax-error" ["message" <+> (Atom s)]
- | MultigroupNotFound s -> error "multigroup-not-found" ["name" <+> (Atom s)]
- | Conflict { old_db; new_db } -> error "conflict" ["old-hash" <+> (Atom old_db.hash);
- "new-hash" <+> (Atom new_db.hash)]
+ | RelationNotFound s -> error "relation-not-found" [ "relation" <+> Atom s ]
+ | RelationAlreadyExists s ->
+ error "relation-already-exists" [ "relation" <+> Atom s ]
+ | TupleNotFound h -> error "tuple-not-found" [ "hash" <+> Atom h ]
+ | DuplicateTuple h -> error "duplicate-tuple" [ "hash" <+> Atom h ]
+ | ConstraintViolation s ->
+ error "constraint-violation" [ "message" <+> Atom s ]
+ | StorageError s -> error "storage-error" [ "message" <+> Atom s ]
+ | UnrecognizedSublanguage s ->
+ error "unrecognized-sublanguage" [ "tag" <+> Atom s ]
+ | MalformedExpression s -> error "malformed-expression" [ "expression" <+> s ]
+ | SublanguageError s -> error "sublanguage-error" [ "error" <+> s ]
+ | SyntaxError s -> error "syntax-error" [ "message" <+> Atom s ]
+ | MultigroupNotFound s -> error "multigroup-not-found" [ "name" <+> Atom s ]
+ | Conflict { old_db; new_db } ->
+ error "conflict"
+ [ "old-hash" <+> Atom old_db.hash; "new-hash" <+> Atom new_db.hash ]