基于docs,在bit-framework中有一些已知的异常类型。
https://docs.bit-framework.com/docs/bit-server-side/web-api.html#exceptions
我们如何扩展此列表?
答案 0 :(得分:2)
看一下以下代码:
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;
}
希望这有帮助