Top "Try-catch" questions

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

General decorator to wrap try except in python?

I'd interacting with a lot of deeply nested json I didn't write, and would like to make my python script …

python try-catch wrapper decorator
Try / Catch in Constructor - Recommended Practice?

Something I've always been curious of public class FileDataValidator { private String[] lineData; public FileDataValidator(String[] lineData){ this.lineData = lineData; removeLeadingAndTrailingQuotes(); …

java oop exception try-catch ooad
Correct Try...Catch Syntax Using Async/Await

I like the flatness of the new Async/Await feature available in Typescript, etc. However, I'm not sure I like …

javascript promise async-await try-catch ecmascript-2017
IntelliJ IDE gives error when using Try-Catch with Resources

I am attempting to use JDK 7's "try-catch with resources" statement; IntelliJ highlights my resource line, saying Try-with-resources are not …

java intellij-idea try-catch try-catch-finally try-with-resources
Exception traceback is hidden if not re-raised immediately

I've got a piece of code similar to this: import sys def func1(): func2() def func2(): raise Exception('test error') …

python exception exception-handling try-catch traceback
catching an IOError in python

I wrote a method that does some stuff and catches bad filenames. what should happen is if the path doesn't …

python exception exception-handling try-catch ioerror
yield return with try catch, how can i solve it

I've a piece of code: using (StreamReader stream = new StreamReader(file.OpenRead(), Encoding)) { char[] buffer = new char[chunksize]; while (stream.…

c# .net-3.5 try-catch yield-return
Close connection and statement finally

Which is better for finally block: finally { try { con.close(); stat.close(); } catch (SQLException sqlee) { sqlee.printStackTrace(); } } Or: finally { try { …

java jdbc connection try-catch finally
In Javascript, is it expensive to use try-catch blocks even if an exception is never thrown?

Is it "slow" to use several try-catch blocks when no exceptions are thrown in any of them? My question is …

javascript performance exception try-catch
How do exceptions work (behind the scenes) in c++

I keep seeing people say that exceptions are slow, but I never see any proof. So, instead of asking if …

c++ performance exception throw try-catch