123456789101112131415161718192021222324252627282930open!ImportmodulePrintexc=Caml.Printexc(* Small helper to find out who is the caller of a function *)typet=Printexc.locationoptionletget~skip=letskip=__FILE__::skipinletstack=Printexc.get_callstack16inletlen=Printexc.raw_backtrace_lengthstackinletreclooppos=ifpos=lenthenNoneelsematchPrintexc.get_raw_backtrace_slotstackpos|>Printexc.convert_raw_backtrace_slot|>Printexc.Slot.locationwith|None->None|Someloc->ifList.mem~equal:String.equalskiploc.filenamethenloop(pos+1)elseSomelocinloop0;;