[reporting] Fail loudly when we can't log an error

Summary:
When you try to log an error on a procedure P and a summary for P doesn't exist, the error gets quietly dropped on the floor.
But we should fail loudly instead, because this should only happen in the case of a user error.
Got burned by this today; I was trying to log an error on the *caller* of `Integer.parseInt`, but was accidentally logging it to `Integer.parseInt` itself instead.
Since no summary for that method exists, my error wasn't appearing.

Reviewed By: jvillard, jeremydubreil

Differential Revision: D4355546

fbshipit-source-id: db2a0e6
master
Sam Blackshear 8 years ago committed by Facebook Github Bot
parent 72d065017b
commit abde4e6603

@ -63,7 +63,12 @@ let log_issue
| Some summary -> | Some summary ->
let err_log = summary.Specs.attributes.ProcAttributes.err_log in let err_log = summary.Specs.attributes.ProcAttributes.err_log in
log_issue_from_errlog err_kind err_log ?loc ?node_id ?session ?ltr exn log_issue_from_errlog err_kind err_log ?loc ?node_id ?session ?ltr exn
| None -> () | None ->
failwithf
"Trying to report error on procedure %a, but cannot because no summary exists for this \
procedure. Did you mean to log the error on the caller of %a instead?"
Procname.pp proc_name
Procname.pp proc_name
let log_error = log_issue Exceptions.Kerror let log_error = log_issue Exceptions.Kerror
let log_warning = log_issue Exceptions.Kwarning let log_warning = log_issue Exceptions.Kwarning

Loading…
Cancel
Save