Help get this topic noticed by sharing it on Twitter, Facebook, or email.

Global Error Logging and errors not being shown in Controller

Hi.

I have implemented a Global Error Logging as described in this blog article:
https://codeontime.com/blog/2019/02/g...

It works perfectly to the point where the errors get logged into the database table, but somehow the customized errror message doesn't get shown to the user. I have the HandleException defined exactly like the blog article:


public partial class Controller
{
protected override void HandleException(Exception ex, ActionArgs args, ActionResult result)
{
// by default the exception is reported to the user in result.Errors property
base.HandleException(ex, args, result);

// log error in the database
var errorDetails = new JObject();
errorDetails["args"] = JObject.FromObject(args);
var errorID = ApplicationServices.LogError(errorDetails, ex);

// replace the error message reported to the user with a custom error
if (result.Errors.Count > 0)
{
result.Errors.Clear();
result.Errors.Add(string.Format("Error {0}. Please contact the Help Desk.", errorID));
}
}
}


If I put a breakpoint to the result.Errors.Add line, it seems to work just fine, but nothing is shown.
Would anyone have an idea of what I could check or change in order for the message to be displayed?

Thanks in advance.

Ivan
(COT 8.7.13.0, Unlimited, TouchUI, SPA)
1 person has
this question
+1
Reply