Created
April 20, 2021 20:35
-
-
Save ankitvijay/e0c03d9983e5d30087fa6e9261ec796c to your computer and use it in GitHub Desktop.
Consistent Error Logging - Exception for different Error Status codes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Runtime.Serialization; | |
[Serializable] | |
// Used for HttpStatusCode 404 (NotFound) | |
public class ResourceNotFoundException : Exception | |
{ | |
public ResourceNotFoundException(string message) : base(message) | |
{ | |
} | |
public ResourceNotFoundException(string message, Exception innerException) : base(message, innerException) | |
{ | |
} | |
protected ResourceNotFoundException(SerializationInfo info, StreamingContext context) : base(info, context) | |
{ | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Runtime.Serialization; | |
[Serializable] | |
// Used for HttpStatusCode 400 (BadRequest) or 422 (UnprocessableEntity) | |
public class DomainException : Exception | |
{ | |
public DomainException(string message) : base(message) | |
{ | |
} | |
public DomainException(string message, Exception innerException) : base(message, innerException) | |
{ | |
} | |
protected DomainException(SerializationInfo info, StreamingContext context) : base(info, context) | |
{ | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment