Top "Try-catch" questions

try-catch is a syntactic construct for catching exceptions raised by a code section

how to manage nested transaction with try catch

--Drop Table Tab1 Begin Transaction TR1; Save Transaction TR1; Create Table Tab1(f1 decimal(10,0)); Begin Transaction TR2 Save Transaction TR2 …

sql-server try-catch sqltransaction savepoints nested-transactions
Powershell Try Catch and retry?

I have this script #Change hostname [void][System.Reflection.Assembly]::LoadWithPartialName('Microsoft.VisualBasic') Write-Host "Change hostname " -NoNewLine $ComputerName = [Microsoft.VisualBasic.…

loops powershell try-catch finally
What is the difference between throw e and throw new Exception(e)?

Consider: try { // Some code here } catch (IOException e) { throw e; } catch (Exception e) { throw e; } What is the difference between …

java exception try-catch throw
python try except yield combination

I use function f to create generator but sometimes it can raise error. I would like two things to happen …

python try-catch yield except
Execution of statements after try/catch block containing return

There are three cases to be considered : Case 1: public class Test { public static void main(String[] args) { System.out.println(1); …

java return try-catch try-catch-finally
How to call a method that throws an exception in catch block?

I am trying to have an HandleException method that can handles various exceptions. The problem is, my function returns a …

java exception-handling try-catch throws
Try-with-resources equivalent in Java 1.6

I have the following code: public class Main { public static void main(String[] args) throws SQLException { try ( Connection conn = DBUtil.…

java try-catch try-with-resources
python try-finally

Why does the exception in foo whizz by unnoticed, but the exception in bar is raised? def foo(): try: raise …

python exception try-catch finally
An Exception Handling Class

What is the best practice for handling exceptions without having to put try/catch blocks everywhere? I had the idea …

c# exception-handling try-catch rethrow
Python: Multiple try except blocks in one?

Is there a neat way to have multiply commands in the try block so that it basically tries every single …

python try-catch except