Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

rebus-org/Unawares

Open more actions menu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Unawares

Just some AspNetCore middlewares.

Currently there's only one.

Exception Mapper

Go

app.UseExceptionMapper(
	builder => builder
		.Map<ArgumentException>(HttpStatusCode.BadRequest)
		.Map<EntityNotFoundException>(HttpStatusCode.NotFound)
		.Map<Exception>(
			status: HttpStatusCode.InternalServerError, 
			criteria: exception => exception.Message.StartsWith("oh no!")
		)
);

to map some exceptions to some HTTP status codes.

Please register it BEFORE your web app so it can catch its exceptions:

app.UseExceptionMapper(...);

// (...)

app.UseEndpoints(...);

Landing Page redirector

It's just

app.UseLandingPage("swagger");

to redirect (HTTP 302) to e.g. the swagger UI.

About

🎎 Random AspNetCore middlewares

Resources

License

Stars

Watchers

Forks

Packages

No packages published
Morty Proxy This is a proxified and sanitized view of the page, visit original site.