add exception type to bit framework known exceptions

爷,独闯天下 提交于 2019-12-23 10:15:24

问题


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?


回答1:


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



来源:https://stackoverflow.com/questions/46202292/add-exception-type-to-bit-framework-known-exceptions

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!