将异常类型添加到位框架已知异常
add exception type to bit framework known exceptions
根据文档,位框架中有一些已知的异常类型。
https://docs.bit-framework.com/docs/bit-server-side/web-api.html#exceptions
我们如何扩展这个列表?
看看下面的代码:
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;
}
希望对您有所帮助
根据文档,位框架中有一些已知的异常类型。
https://docs.bit-framework.com/docs/bit-server-side/web-api.html#exceptions
我们如何扩展这个列表?
看看下面的代码:
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;
}
希望对您有所帮助