2017-09-13 72 views

回答

1

看看下面的代碼:

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; 
} 

希望這有助於

相關問題