Exception filters आपको इस बात पर पूर्ण नियंत्रण देते हैं कि errors को कैसे पकड़ा जाए और responses में बदला जाए। वे request lifecycle के अंत में बैठते हैं, request में कहीं भी throw किए गए exceptions को पकड़ते हैं और आपको error response के format, status, और logging को customize करने देते हैं।
एक बुनियादी exception filter
{ , , , } ;
()
{
(: , : ) {
ctx = host.();
response = ctx.();
request = ctx.();
status = exception.();
response.(status).({
: status,
: ().(),
: request.,
: exception.,
});
}
}
