diff options
Diffstat (limited to '')
| -rw-r--r-- | lib/manipulation.ml | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/manipulation.ml b/lib/manipulation.ml index 73607fa..be77c02 100644 --- a/lib/manipulation.ml +++ b/lib/manipulation.ml @@ -23,6 +23,24 @@ type error = | ConstraintViolation of string | StorageError of string +let string_of_error = function + | RelationNotFound s -> "RelationNotFound: " ^ s + | RelationAlreadyExists s -> "RelationAlreadyExists: " ^ s + | TupleNotFound h -> "TupleNotFound: " ^ h + | DuplicateTuple h -> "DuplicateTuple: " ^ h + | ConstraintViolation s -> "ConstraintViolation: " ^ s + | StorageError s -> "StorageError: " ^ s + +let sexp_of_error e = + let open Sexplib.Sexp in + match e with + | RelationNotFound s -> List [Atom "relation-not-found"; Atom s] + | RelationAlreadyExists s -> List [Atom "relation-already-exists"; Atom s] + | TupleNotFound h -> List [Atom "tuple-not-found"; Atom h] + | DuplicateTuple h -> List [Atom "duplicate-tuple"; Atom h] + | ConstraintViolation s -> List [Atom "constraint-violation"; Atom s] + | StorageError s -> List [Atom "storage-error"; Atom s] + (** Result type for operations *) type 'a result = ('a, error) Result.t |
