[Pkg-ocaml-maint-commits] [SCM] approx upstream and debian packaging branch, upstream, updated. upstream/3.5-41-g482c98d

Eric Cooper ecc at cmu.edu
Wed Jun 23 18:47:07 UTC 2010


The following commit has been merged in the upstream branch:
commit 482c98d8445c2b2935d8d707dae85c7dca78c384
Author: Eric Cooper <ecc at cmu.edu>
Date:   Wed Jun 23 12:22:10 2010 -0400

    print backtrace for uncaught server exceptions

diff --git a/approx.ml b/approx.ml
index a210c42..e2fe165 100644
--- a/approx.ml
+++ b/approx.ml
@@ -423,7 +423,14 @@ let ims_time env =
   try Netdate.parse_epoch (env#input_header#field "If-Modified-Since")
   with Not_found | Invalid_argument _ -> 0.
 
-let server_error msg = `Std_response (`Internal_server_error, None, Some msg)
+let server_error e =
+  let bt = Printexc.get_backtrace () in
+  if bt <> "" then begin
+    error_message "%s" "Uncaught exception";
+    let pr s = if s <> "" then error_message "  %s" s in
+    List.iter pr (split_lines bt)
+  end;
+  `Std_response (`Internal_server_error, None, Some (string_of_exception e))
 
 let is_repository name =
   try String.index name '/' = String.length name - 1
@@ -449,7 +456,7 @@ let serve_file env =
         match serve_local name ims env with
         | Done reaction -> reaction
         | Cache_miss mod_time -> cache_miss url name ims mod_time
-    with Failure msg | Invalid_argument msg-> server_error msg
+    with e -> server_error e
 
 let process_header env =
   debug_message "Connection from %s"

-- 
approx upstream and debian packaging



More information about the Pkg-ocaml-maint-commits mailing list