Getting started
Installation
dotnet add package Webinex.Coded
dotnet add package Webinex.Coded.AspNetCore
Project setup
Startup.cs
public void ConfigureServices(IServiceCollection services)
{
// ...
services
.AddCodedFailures()
}
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
// ...
app.UseCodedExceptions()
}
Start using it
UserService.cs
public class UserService
{
public async Task AddAsync(User user)
{
if (user.Email == null)
throw CodedException.Invalid(new { user.Email });
// ...
}
}