Most voted "try-catch" questions
Try-catch is a syntactic construct used in programming languages for handling exceptions, which can occur in a section or section of the program.
Learn more…71 questions
Sort by count of
-
1
votes1
answer45
viewsDoubt about exceptions and Try/catch blocks
I would like to know what is the "correct way" to write a Try/catch block: async function ping() { try { undefined(); return 'pong'; } catch (error) { console.log('fn ping:', error); } } async…
-
1
votes0
answers35
viewsOperation I/O 'Block' loop?
Greetings friends, I come here to ask for help in relation to doubt about the operations of Request and with the operation Open. As far as I know and read, the operation file_request =…
-
0
votes1
answer128
viewsCreating a Custom Exception from Pdoexception
Hello. I need to implement a custom Exception that extends from Pdoexception and with it create some methods that return standard messages. So far I have only found unclear examples. Someone has…
-
0
votes1
answer201
viewsCatch problem with Mysql connection c#
Hello I’m a beginner in programming and I’m having trouble connecting Mysql in c#, where the code does not check and goes to catch action. Follows the code: conexaoDataSet = new DataSet(); conexao =…
-
0
votes1
answer577
viewsJava - Swing - Timeunit.Leep time counter
I’m using Swing in Netbeans, creating a simple math game (thought more feasible than a calculator) whose goal is to add up the random numbers of the buttons until it equals a number between 1 and…
-
0
votes1
answer70
viewsAlgorithm does not enter Catch (Try/catch)
I’m learning programming and came across the Try catch, however my code never enters the catch.. <?php class NewsLetter{ public function cadastrarEmail($email){…
-
0
votes0
answers314
viewsDifference between Try-catch / then-catch
I just started the Promises study and came across the second dilemma: What’s the difference between using Ry and catch to handle errors and then and catch? What’s the best case for each of them?…
-
0
votes1
answer95
viewsRewrite code using the Try-with-Resources resource
My problem is to rewrite a code using the Try-with-Resources feature, as I’m new in the world of programming I’m not being able to learn how to do this, which is becoming something exciting, because…
-
0
votes4
answers362
viewsHow do I skip the "Finally" block, in C#, when the exception is generated?
If the exception is generated, I want to know if there is a way to "skip" the execution of the block finally. If there is no exception, the finally perform normally. With the goto didn’t work. Code:…
-
0
votes1
answer123
viewsInfinite Loop in Exception Handling
I’m trying to make a try to ask for the option number for the user, but I want to do this until he type an integer number, I did a Try/catch, but when I run it and digit a string it keeps sending an…
-
0
votes1
answer72
viewsResultset object is null after Try-catch. Java
I did a query in my database and it worked, but I’m not able to use the Resultset of this query. I debugged and found that it has a correct content, but it gets null after Try catch where it is…
-
0
votes1
answer117
viewsHow to make a Try catch with mathematical operators?
I’m doing an activity that consists of a simple calculator, but accepts operations with multiple operators (example: 1+2+3-4 = 2). I have already made a Try catch to handle the error if the user…
-
0
votes1
answer348
viewsTry/catch on switch creating infinite loop on run
I’m also wanting to implement a try/catch within the while so that when a user enters a double with a dot instead of a comma, the program points the error and sends it back to code execution. But…
-
0
votes1
answer88
viewscapture duplicity error in mysql with java
I’m trying to show a message that there is already a registered id, but it falls in the catch that shows: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry…
-
0
votes1
answer57
viewsError: Undefined Binding(s) when I’m going to give a
I’m trying to make a login system , I wrote the code and when I do it works perfectly , but when I made the connection to the front end using Axios it can’t send the typed data to the database. I…
-
-1
votes2
answers548
viewsHow to generate error in logerror.txt file?
I am trying to generate errors in the file logerro.txt, but I don’t know how to do it. I used the syntax error function: try{ }else(PDOException $e){ echo'Sistema indisponível'; LogErros($e); I used…
-
-1
votes1
answer666
viewsDifference between Error - Exception - Throwable within catch()
Always when I treated the catch I wore (Exception e) but a few days ago I came across an exception that did not fit the catch (Exception e) then I discovered that she is not really an exception but…
-
-1
votes1
answer77
viewsWhat is the best way to check? (Try-catch, if multiples,...?)
I am reading thousands of XML files with python. The problem is, there is not always the field in all files. resumo_cv = root.find("DADOS-GERAIS").find("RESUMO-CV").get("TEXTO-RESUMO-CV-RH")…
-
-1
votes1
answer626
viewsTreat error when connecting to Mysql with PDO
People would like to treat the error that occurs if the Mysql server is not running, I want only one message to appear so I made the following code: function mensagemErro () { throw new…
-
-1
votes1
answer65
viewsHow to make the program continue where I left off after an exception happens in my Ry
In this excerpt I got the expected result, which was not close the program after the error message if the user enters with wrong data. However, even if I’m in the 10th, it resets to the first. So…
-
-3
votes0
answers33
viewsTry Catch in infinite looping
Whoa, guys, blz? First time here and I’m starting to learn Java as my first programming language. Okay, my teacher sent me a challenge to make a simple program that asks the user for an…