Search code examples
javanewrelic

How can notice an error with parameters, throwable and message


I see the api for noticeError, and I have the options

NewRelic.noticeError(Throwable throwable)
NewRelic.noticeError(Throwable throwable, Map<String, String> params)
NewRelic.noticeError(String message, Map<String, String> params)

I need (ok, want) an option like

NewRelic.noticeError(String message, Throwable throwable, Map<String, String> params)

Is there a reason it isn't present? I can not find a valid alternative:

If I wrap the original exception in a new one with my custom message, I can't see the original exception in the Error panel

If I pass the custom message as a param value in the map, I can't see that message in the Error panel

Is there anything I can see? Am I doing something wrong?


Solution

  • The NewRelic.noticeError calls are per transaction, it is perfectly acceptable to run one after another.

    Instead of wrapping, try running them like this:

    NewRelic.noticeError(Throwable throwable, Map<String, String> params)
    NewRelic.noticeError(String message, Map<String, String> params)