Commits

ysulsky committed d362493

async: backtrace.get may be unimplemented

  • Participants
  • Parent commits c74878f

Comments (0)

Files changed (3)

File base/async/core/lib/debug.ml

     everytime it schedules a job, and will include the backtrace history in any exceptions
     raised to monitors, and in particular, in an unhandled exception that reaches the main
     monitor. *)
-let record_backtraces = is_some (Sys.getenv "RECORD_ASYNC_BACKTRACES")
+let record_backtraces =
+  match Backtrace.get with
+  | Ok _ -> is_some (Sys.getenv "RECORD_ASYNC_BACKTRACES")
+  | Error _ -> (* unimplemented *) false
 
 (* Calls to [Debug.log] should look like [if Debug.debug then Debug.log ...]. *)
 

File base/async/core/lib/execution_context.ml

   }
 ;;
 
-let record_backtrace t =
-  { t with
-    backtrace_history = Backtrace.get () :: t.backtrace_history;
-  }
+let record_backtrace =
+  match Backtrace.get with
+  | Ok get ->
+    fun t ->
+      { t with
+        backtrace_history = get () :: t.backtrace_history;
+      }
+  | Error _ -> Fn.id
 ;;

File base/core/lib/backtrace.mli

    frames, but [to_string] does not. *)
 type t with sexp_of
 
-val get : (unit -> string) Or_error.t
+val get : (unit -> t) Or_error.t
 
 val to_string : t -> string