Search code examples
c#servicestackservicestack-bsd

ServiceStack ServiceExceptionHandler.Add method does not exists?


I am using ServiceStack version 3.9.71 and I cannot find the "Add" method. Is the documentation on the wiki outdated? What should I do in order to make it work?

public override void Configure(Container container)
{
    this.ServiceExceptionHandler.Add((httpReq, request, exception) => {
        return DtoUtils.CreateErrorResponse(request, exception);
    });
}

Solution

  • You are looking at the v4 documentation. You need the v3 documentation.

    //Handle Exceptions occurring in Services:
    this.ServiceExceptionHandler = (httpReq, request, exception) => {
        //log your exceptions here
        ...
        //call default exception handler or prepare your own custom response
        return DtoUtils.HandleException(this, request, exception);
    };
    

    Note the v3's in the url: https://github.com/ServiceStackv3/ServiceStackv3/wiki