PandaWood/ExceptionReporter.NET

Send exception report to a WebService URL

trparky opened this issue · 6 comments

I would like to see the ability to have the exception data submitted to a server-side script, be it written in PHP or server-side .NET. The reason being is that not a lot of people have email clients installed or are using web-based email such as GMail. Submitting the data to a web script would make submitting the data much easier.

Hey @trparky, so do you mean make an HTTP connection to a standard (or configurable) web API. And basically post the exception report to that?

Yep.

I've discussed having this elsewhere and I now think this is a better idea than I previously thought.

Maybe the correct term here is "WebService".
A configurable URL that takes a POST packet of any (or predefined JSON) data, for you to consume and use however you want.

Apologies I didn't see this idea properly before.
I definitely think this would be useful as SMTP requires a password, potentially exposed... and MAPI (manual email sending) might not be convenient for some users.

So basically, I just need to add a configuration of WebServiceUrl and write additional code in ExceptionReporter to POST JSON to this URL

PS I've updated the original title to reflect the words I would use to describe it.

I've just added this support for sending to a WebService - specifically a REST API that receives and responds with JSON.

I even added a .NET Core project to the solution that runs a REST service and process the incoming requests made by ExceptionReporter - just to be perfectly clear about what's required.
I will probably add one more feature (SilentReportSending) before I release this.

Just some more detail on this incase anyone wants to provide input...

ExceptionReporter.NET configured to send to a WebService requires the EmailMethod Config (ExceptionReportInfo) property to be set to a new enumeration option MailMethod.WebService and the other new property WebServiceUrl eg "http://localhost:24513/api/er"
There's also a WebServiceTimeout which I default to 15 seconds.

We send 4 properties as JSON to the WebService as a "POST" (ie REST "CREATE")
It Accepts and has Content-Type of "application/json" and sends a UTF8 JSON string.

These seem to be the obvious defaults of a modern REST API - so I trust these are all good choices ;-)

{
  "AppName" : "My App",
  "AppVersion" : "1.0.2",
  "ExceptionMessage" : "Null Ref...",
  "ExceptionReport" : "The plain text of the entire report here..."
}