Answers for "c# get error code from exception"

C#
0

how to get error code from exception in c#

try {
	// some operation causing an exception
}
catch (SqlException e) {
	if (e.ErrorCode == 0x80131904)
      	// ...
		return null;
	throw;
}
Posted by: Guest on March-25-2021
0

c# return error status code based on exception

[HttpGet]
    public ActionResult<YOUROBJECT> Get()
    {
        return StatusCode(304, YOUROBJECT); 
    }
Posted by: Guest on November-03-2021

Code answers related to "c# get error code from exception"

C# Answers by Framework

Browse Popular Code Answers by Language