Questions tagged as 'try-catch'

3
answers

Run program within Try / Catch

Working with Visual Studio, when an error occurs while the program is running the program crashes and you can not see where the program crashed and only that error screen appeared. To get where these errors occur we use try catch , so w...
asked by 06.03.2014 / 13:24
4
answers

What is the function of the "| "Inside the catch?

I read that || (OR) is for boolean operations and | (Bitwise operation) for bit operations. What is its function inside a catch with multiple exceptions , then? I mean, I know it eliminates duplicate code but I've always considere...
asked by 22.04.2015 / 20:15
2
answers

Try catch can be replaced with using?

I've always used the blocks try , catch and finally when programming in Java, and when I switched to C # I noticed that some codes change try/catch by using . Example: using (FileStream fs = new FileStream("...
asked by 07.08.2016 / 03:19
1
answer

Centralize (use only one) a try-catch for the entire WPF application

Is there any way to centralize a try-catch for every application in a WPF application with C #? I've created a window to use as a% custom%. When you get an error in any system registry error, does it always fall into the same Messag...
asked by 18.12.2015 / 17:45
2
answers

When to use try catch in layered application?

Let's say I have my layers Controller Business Repository So it is necessary to create this block in the 3 layers or create only in controller ? If I do this does it guarantee that any code that is made inside it will be thrown at...
asked by 22.11.2018 / 17:01
1
answer

Execution flow of a try / catch / finally block

How does the execution flow in a try/catch/finally block work in the example below? public class ExceptionTest { public static void makeException() throws ExceptionAlpha, ExceptionBeta, ExceptionGamma { throw new Exception...
asked by 02.08.2014 / 18:40
2
answers

How to handle exception that can not delete because it is a foreign key

I can not handle an exception that happens when I delete an address that is being used in another table. I'm using codeigniter My code is: public function delete_endereco($cod_clientes_endereco){ try{ $acao = $this->db->de...
asked by 27.10.2015 / 16:28
2
answers

Try and Catch continue execution (after exception)?

How do I put a block try and catch to continue the loop for , even if it gives arrayindexofbounds and among others exception? I put it in and it runs but the output of "m" does not print anything after! for (String f...
asked by 27.01.2015 / 11:11
2
answers

What are the Try / Catch blocks?

I would like to know what the try...catch blocks are. I would like more information in Portuguese, because in English I did not understand much, only that it would be a kind of if...else . What are these try...catch bl...
asked by 07.03.2017 / 19:20
1
answer

Is it possible to throw an error that triggers others?

Here's an example: public class Teste { public static void main(String[] args) { func1(); } public static void func1() { try { func2(); } catch (Exception e) {...
asked by 21.10.2016 / 21:46