Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

Common way to register catching the exception of Web API

$
0
0

Currently, for each Web API, I catch the exception like the below:

            try
            {
                //My code
                return Ok();
            }
            catch (Exception ex)
            {
                return new ExceptionResult(ex, true);
            }


I am thinking if any other common way to do this catch exception, so that I do not need to do "try catch" for every Web API.


Viewing all articles
Browse latest Browse all 9386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>