I have a function that returns ('a, Caqti_error.t) result and I’m trying to catch unique violation error
| Ok _ -> ....
| Error err -> (
match err with
| `Response_failed err -> (
let cause = `Response_failed err |> Caqti_error.cause in
match cause with
| `Integrity_constraint_violation__don't_match ->
print_string "intercepted!"
| _ -> ())
| _ -> ())
After launching I see in the console “intercepted!”, Am I doing the type narrowing correctly? Why is the uniqueness error in Response_failed and not in Request_failed? Or is this a feature of the sqlite3 driver?