Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

add exception type to bit framework known exceptions

based on docs, there are some known exception types in bit-framework.

https://docs.bit-framework.com/docs/bit-server-side/web-api.html#exceptions

How can we extend this list?

like image 320
1SaeedSalehi Avatar asked Sep 13 '17 16:09

1SaeedSalehi


1 Answers

Take a look at following code:

public class MyException : Exception, IKnownException /*Required*/, IHttpStatusCodeAwareException /*Optional >> Default is InternalServerError (500)*/
{
    public MyException(string message)
        : base(message)
    {
    }

    public HttpStatusCode StatusCode { get; set; } = HttpStatusCode.Conflict;
}

Hope this helps

like image 155
Yaser Moradi Avatar answered Nov 15 '22 03:11

Yaser Moradi