Skip to content

Latest commit

 

History

History
67 lines (50 loc) · 2.52 KB

File metadata and controls

67 lines (50 loc) · 2.52 KB

Never write another custom exception class ever again.

EZXception

EZXception is a netstandard2.0 library that ships 50+ pre-built, richly structured exception types covering every scenario a .NET developer encounters - validation, authorization, data access, business rules, configuration, external services, file I/O, networking, serialization, concurrency, and domain modeling.

Instead of writing this every time:

public class UserNotFoundException : Exception
{
    public UserNotFoundException(string id)
        : base($"User '{id}' was not found.") { }
}

You just do this:

throw new EntityNotFoundException("User", id);

Every exception carries typed contextual properties (entity name, field name, status code, timeout, etc.) so catch blocks can read structured data instead of parsing message strings.

Get Started

dotnet add package EZXception --version 1.0.0

Documentation

Naming Notes

Three exceptions carry an EZ prefix to avoid compile-time ambiguity with identically named BCL types:

EZXception type Would shadow
EZXception.IO.EZFileNotFoundException System.IO.FileNotFoundException
EZXception.IO.EZDirectoryNotFoundException System.IO.DirectoryNotFoundException
EZXception.Serialization.EZSerializationException System.Runtime.Serialization.SerializationException

License

MIT