Questions tagged [error-handling]

Programming language constructs designed to handle errors signaled by error codes, exceptions or other language specific means.

Error Handling comprises design of the code that handles errors, as opposed to the code that handles the (normal) program logic in the absence of errors during program execution.

See also

22833 questions
221
votes
11 answers

JAX-RS / Jersey how to customize error handling?

I'm learning JAX-RS (aka, JSR-311) using Jersey. I've successfuly created a Root Resource and am playing around with parameters: @Path("/hello") public class HelloWorldResource { @GET @Produces("text/html") public String get( …
Mark Renouf
  • 29,573
  • 19
  • 89
  • 120
218
votes
17 answers

live output from subprocess command

I'm using a python script as a driver for a hydrodynamics code. When it comes time to run the simulation, I use subprocess.Popen to run the code, collect the output from stdout and stderr into a subprocess.PIPE --- then I can print (and save to a…
DilithiumMatrix
  • 15,044
  • 15
  • 64
  • 102
209
votes
13 answers

Cryptic "Script Error." reported in Javascript in Chrome and Firefox

I have a script that detects Javascript errors on my website and sends them to my backend for reporting. It reports the first error encountered, the supposed line number, and the time. EDIT to include doctype:
Mike Sherov
  • 12,634
  • 7
  • 38
  • 62
204
votes
21 answers

Is assert evil?

The Go language creators write: Go doesn't provide assertions. They are undeniably convenient, but our experience has been that programmers use them as a crutch to avoid thinking about proper error handling and reporting. Proper error handling…
Frank
  • 58,417
  • 87
  • 227
  • 317
202
votes
22 answers

Deploying website: 500 - Internal server error

I am trying to deploy an ASP.NET application. I have deployed the site to IIS, but when visiting it with the browser, it shows me this: Server Error 500 - Internal server error. There is a problem with the resource you are looking for, and it…
Jacob Jedryszek
  • 5,987
  • 10
  • 31
  • 39
199
votes
13 answers

Detailed 500 error message, ASP + IIS 7.5

IIS 7.5 , 2008rc2, classic asp, 500 error msg: The page cannot be displayed because an internal server error has occurred. I need to know how to configure IIS to get a more detailed error. I've tried setting to true all of debugging options in the…
egidiocs
  • 2,537
  • 3
  • 18
  • 19
190
votes
12 answers

Error-Handling in Swift-Language

I haven't read too much into Swift but one thing I noticed is that there are no exceptions. So how do they do error handling in Swift? Has anyone found anything related to error-handling?
peko
  • 11,049
  • 4
  • 31
  • 47
188
votes
10 answers

Error: could not find function ... in R

This is meant to be a FAQ question, so please be as complete as possible. The answer is a community answer, so feel free to edit if you think something is missing. This question was discussed and approved on meta. I am using R and tried…
Joris Meys
  • 98,937
  • 27
  • 203
  • 258
184
votes
1 answer

try, try! & try? what’s the difference, and when to use each?

In Swift 2.0, Apple introduced a new way to handle errors (do-try-catch). And few days ago in Beta 6 an even newer keyword was introduced (try?). Also, knew that I can use try!. What's the difference between the 3 keywords, and when to use each?
Abdurrahman
  • 5,836
  • 3
  • 16
  • 19
177
votes
5 answers

How do I log ALL exceptions globally for a C# MVC4 WebAPI app?

Background I am developing an API Service Layer for a client and I have been requested to catch and log all errors globally. So, while something like an unknown endpoint (or action) is easily handled by using ELMAH or by adding something like this…
Matt Cashatt
  • 20,878
  • 24
  • 73
  • 105
176
votes
13 answers

What's the source of Error: getaddrinfo EAI_AGAIN?

My server threw this today, which is a Node.js error I've never seen before: Error: getaddrinfo EAI_AGAIN my-store.myshopify.com:443 at Object.exports._errnoException (util.js:870:11) at errnoException (dns.js:32:15) at…
ThomasReggi
  • 42,912
  • 63
  • 199
  • 343
175
votes
11 answers

Log exception with traceback

How can I log my Python errors? try: do_something() except: # How can I log my exception here, complete with its traceback?
TIMEX
  • 217,272
  • 324
  • 727
  • 1,038
173
votes
26 answers

Eclipse returns error message "Java was started but returned exit code = 1"

I just downloaded and dearchived android SDK for Windows. I`m currently using W8 64x.
Vladislav Bogdanov
  • 1,833
  • 3
  • 14
  • 10
165
votes
23 answers

Error handling in C code

What do you consider "best practice" when it comes to error handling errors in a consistent way in a C library. There are two ways I've been thinking of: Always return error code. A typical function would look like this: MYAPI_ERROR…
Laserallan
  • 10,434
  • 9
  • 39
  • 63
157
votes
9 answers

"Inner exception" (with traceback) in Python?

My background is in C# and I've just recently started programming in Python. When an exception is thrown I typically want to wrap it in another exception that adds more information, while still showing the full stack trace. It's quite easy in C#,…
EMP
  • 51,372
  • 47
  • 157
  • 214