Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Service stack elmah implementation

We have recently updated the version of ServiceStack.Logging.Elmah and the code that used to work in our older version no longer works:

        ServiceExceptionHandler += (request, exception) =>
        {
            var context = HttpContext.Current;
            Elmah.ErrorLog.GetDefault(context).Log(new Error(exception,context));
            return DtoUtils.HandleException(this, request, exception);
        };

It doesnt compile on the exception variables for new Error(). I have tried casting them to Exception but this just causes another error on the whole lot of code 'Cannot apply operator '+=' to operands of type 'ServiceStack.WebHost.Endpoints.HandleServiceExceptionDelegate' and 'lambda expression'. Struggling to find any documentation for the update, could anyone let me know what the code change is?

like image 226
Grace Avatar asked Jul 12 '26 13:07

Grace


1 Answers

The signature for ServiceExceptionHandler is now:

ServiceExceptionHandler += (httpReq, request, exception) => { .. }

I recommend joining the ServiceStack G+ Community to get notified of any breaking changes during releases.

like image 132
mythz Avatar answered Jul 14 '26 04:07

mythz



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!