Library
Module
Module type
Parameter
Class
Class type
Module for the general Mssql exception type Mssql_error
. This lets us raise nice exception that always have their source code position, and optionally contain a query string, parameters, formatted query string, and result rows
type t = {
msg : string;
reraised_exn : Core_kernel.Exn.t option;
here : Core_kernel.Source_code_position.t;
query : string option;
params : Mssql__.Db_field.t option list;
formatted_query : string option;
results : Row.t list list;
}
val sexp_of_t : t -> Ppx_sexp_conv_lib.Sexp.t
exception Mssql_error of t
val failwith :
?query:string ->
?params:Mssql__.Db_field.t option list ->
?formatted_query:string ->
?results:Row.t list list ->
?exn:Core_kernel.Exn.t ->
?backtrace:Core_kernel.Caml.Printexc.raw_backtrace ->
Core_kernel.Source_code_position.t ->
string ->
_
failwith [%here] msg
raises a Mssql_error
with the given options and message
val failwithf :
?query:string ->
?params:Mssql__.Db_field.t option list ->
?formatted_query:string ->
?results:Row.t list list ->
?exn:Core_kernel.Exn.t ->
?backtrace:Core_kernel.Caml.Printexc.raw_backtrace ->
Core_kernel.Source_code_position.t ->
('a, unit, string, _) Core_kernel.format4 ->
'a
failwithf [%here] "%..." msg
raises a Mssql_error
with the given options and a sprintf formatted message
val with_wrap :
?query:string ->
?params:Mssql__.Db_field.t option list ->
?formatted_query:string ->
?results:Row.t list list ->
Core_kernel.Source_code_position.t ->
(unit -> 'a) ->
'a
with_wrap_dblib_error [%here] f
calls f
and if it throws an exception, wraps the error in Mssql_error
. There are special cases for if the exn thrown is already Mssql_error
(we always preserve the %here
and preserve the other info if not set), and for Dblib.Error
(using the message directly, to make exceptions more readable -- although we also set reraised_exn
so the original info is all there)