Skip to content

Commit 0e9a5d3

Browse files
author
David Scott
committed
Use the json marshalling when returning Backend_error_with_backtrace
Signed-off-by: David Scott <dave.scott@citrix.com>
1 parent d03e0d6 commit 0e9a5d3

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

main.ml

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -42,18 +42,10 @@ let backend_error name args =
4242
Exception.rpc_of_exnty exnty
4343

4444
let backend_backtrace_error name args error =
45-
match List.zip error.files error.lines with
46-
| None -> backend_error "SCRIPT_FAILED" [ "malformed backtrace in error output" ]
47-
| Some pairs ->
48-
let backtrace =
49-
pairs
50-
|> List.map ~f:(fun (filename, line) -> { B.Interop.filename; line })
51-
|> B.Interop.to_backtrace
52-
|> B.sexp_of_t
53-
|> Sexplib.Sexp.to_string in
54-
let open Storage_interface in
55-
let exnty = Exception.Backend_error_with_backtrace(name, backtrace :: args) in
56-
Exception.rpc_of_exnty exnty
45+
let error = rpc_of_error error |> Jsonrpc.to_string in
46+
let open Storage_interface in
47+
let exnty = Exception.Backend_error_with_backtrace(name, error :: args) in
48+
Exception.rpc_of_exnty exnty
5749

5850
let missing_uri () =
5951
backend_error "MISSING_URI" [ "Please include a URI in the device-config" ]

0 commit comments

Comments
 (0)