mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-06 11:15:31 -05:00
add todos in CCError
This commit is contained in:
parent
e68b951db5
commit
e509ba5461
1 changed files with 8 additions and 0 deletions
|
|
@ -43,16 +43,24 @@ let return x = `Ok x
|
|||
|
||||
let fail s = `Error s
|
||||
|
||||
(* TODO: optional argument for printing stacktrace? *)
|
||||
let fail_printf format =
|
||||
let buf = Buffer.create 16 in
|
||||
Printf.kbprintf
|
||||
(fun buf -> fail (Buffer.contents buf))
|
||||
buf format
|
||||
|
||||
(* TODO: easy ways to print backtrace/stack *)
|
||||
|
||||
(* TODO: something of type [ ('a -> 'b) -> ('err -> 'b) -> ('a, 'err) t -> 'b]
|
||||
to make it easier to switch into a regular variant if it happens *)
|
||||
|
||||
let _printers = ref []
|
||||
|
||||
let register_printer p = _printers := p :: !_printers
|
||||
|
||||
(* FIXME: just use {!Printexc.register_printer} instead? *)
|
||||
|
||||
let of_exn e =
|
||||
let buf = Buffer.create 15 in
|
||||
let rec try_printers l = match l with
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue