基于docs,在bit-framework中有一些已知的异常类型.
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;
}
希望这可以帮助