Questions tagged as 'try-catch'

1
answer

Why can not we use Await within a Catch, Finally and Synclock in VB?

Why can not we use the Await operator within the statements Catch , Finally and Synclock in VB? The C # 6.0 has support for using Await within Catch / Finally .     
asked by 01.01.2017 / 13:43
1
answer

How to use Try / Catch in reading files

I have a method called readFileCredentials that has the purpose of opening a file and returning the data that was inside that file, it follows the code of this method: readFileCredentials = function(file, cb){ var _path = 'data-sour...
asked by 05.05.2016 / 15:20
1
answer

What errors trigger the catch? [duplicate]

In a test similar to this , I stayed in doubts what the errors that generate Exception . Finding I only found explanations of using try , catch , and some references that this would depend on the php_ini setting....
asked by 16.04.2015 / 15:30
1
answer

How not to include the finally and still close IO Streams, Connections, Statements, and other Resources?

We know of the need to close resources (files, connections, also called resources ) consumed in Java, such as OutputStream and InputStream . When we do not close them, we create performance issues and prevent the Garbage Collector...
asked by 28.06.2015 / 17:04
1
answer

Code snippet in Try

I was making corrections in a class and I came across the following code, did not know it was possible and never stopped to think, but why is this valid? I'm referring to the first line of Try. For me try / catch has always been in the format:...
asked by 30.06.2015 / 19:00
2
answers

Handle 404 error without using try / catch

I have the following code snippet that does an HTTP request , but sometimes the URL does not work, then an exception will be thrown by the framework . > HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); request.Method = WebRequ...
asked by 30.08.2016 / 14:06
1
answer

How to handle errors during web scraping?

Hello everyone. During the Web Scraping process, I began to encounter some errors that occur during the requisition process. I have now identified 4 most common types of errors: Error in curl::curl_fetch_memory(url, handle = handle) :...
asked by 17.12.2017 / 17:34
1
answer

PHP Error - Try_Catch [closed]

   Parse error: syntax error, unexpected 'catch' (T_CATCH), expecting end of file in C: \ xampp \ htdocs \ validar_cad_user \ face.php on line 65 My Project is there if anyone can help, Thanks! try { // Returns a 'Face...
asked by 06.02.2018 / 12:56
2
answers

Where should I put the Try / Catch blocks using MVC?

I am doing a web application in java and I have some doubts regarding the try catch block, I am using the MVC standard and I have the following codes: Controller: try { String pesquisa = "%" + request.getParameter("pesquisa") + "%";...
asked by 14.11.2016 / 15:51
3
answers

What is the most recommended "try" or "if"

{ public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { double SalarioBase = 0, Descontos = 0, Vantagens = 0; try { SalarioBase = Con...
asked by 15.05.2017 / 00:19