Try-Catch Doesn’t Handle Everything

Tara Kizer notes that there are limits in what TRY/CATCH blocks handle in SQL Server:

It’s well documented in Books Online (BOL). If you’re like me, then tl;dr. Are we even calling it Books Online these days? I still say “bookmark lookup” instead of “key lookup”. I suppose I’ll be saying Books Online for quite some time too. At least these days it really is online.

Here’s a shortened version:

  • Warnings or informational messages that have a severity of 10 or lower

  • Errors that have a severity of 20 or higher that stop the session

  • Attentions

  • When a session is KILLed

It’s important to know that not everything gets caught, particularly major issues.

Related Posts

SQL Server 2017 and Visual Studio 2017/2019 Installation Error

Hamish Watson walks us through an error which happens when you install SQL Server 2017 and Visual Studio 2019 in the “wrong” order: This blog post is about a situation that initially perplexed me – I was installing SQL Server 2017 onto a new DEMO machine – running Windows Server 2019. This install is one […]

Read More

dbatools and Error Handling

Shane O’Neill takes us through some of the error-handling dynamics available in dbatools: PowerShell errors normally contain useful information on what went wrong. With this information, the “what went wrong” can be fixed. That being said, if you are writing PowerShell scripts and not raising valid error messages then I highly advise you to go […]

Read More

Categories

May 2016
MTWTFSS
« Apr Jun »
 1
2345678
9101112131415
16171819202122
23242526272829
3031