Tag: exception

52 votes
5 answers
2.7K views
How to write trycatch in R

I want to write trycatch code to deal with error in downloading from the web. url <- c( "http://stat.e

avatar
Brianne
0 1 0 9
asked 07 September, 2021
58 votes
12 answers
2.3K views
ASP.NET Core Web API exception handling

I am using ASP.NET Core for my new REST API project after using regular ASP.NET Web API for many years. I don&

avatar
Clarice
0 1 0 9
asked 07 September, 2021
52 votes
2 answers
2.2K views
Why does this Jython loop fail after a single run?

I've got the following code: public static String getVersion() { PythonInterpreter interpreter = ne

avatar
Clarice
0 1 0 9
asked 07 September, 2021
54 votes
3 answers
2.7K views
How to catch an exception in python and get a reference to the exception, WITHOUT knowing the type?

I'm wondering how I can catch any raised object (i.e. a type that does not extend Exception), and still g

avatar
Vi
0 1 0 9
asked 07 September, 2021
58 votes
7 answers
1.6K views
What exceptions should be thrown for invalid or unexpected parameters in .NET?

What types of exceptions should be thrown for invalid or unexpected parameters in .NET? When would I choose on

avatar
Renaldo
0 1 0 9
asked 07 September, 2021
69 votes
5 answers
2.7K views
.NET Global exception handler in console application

Question: I want to define a global exception handler for unhandled exceptions in my console application. In a

avatar
Clarice
0 1 0 9
asked 07 September, 2021
64 votes
12 answers
1.8K views
What does "Fatal error: Unexpectedly found nil while unwrapping an Optional value" mean?

My Swift program is crashing with EXC_BAD_INSTRUCTION and one of the following similar errors. What does this

avatar
Alba
0 1 0 9
asked 07 September, 2021
60 votes
11 answers
2.9K views
Node.js Best Practice Exception Handling

I just started trying out node.js a few days ago. I've realized that the Node is terminated whenever I ha

avatar
Omar
0 1 0 9
asked 07 September, 2021
49 votes
10 answers
938 views
Manually raising (throwing) an exception in Python

How can I raise an exception in Python so that it can later be caught via an except block?

avatar
Royal
0 1 0 9
asked 07 September, 2021
61 votes
5 answers
2.4K views
Catch multiple exceptions in one line (except block)

I know that I can do: try: # do something that may fail except: # do this if ANYTHING goes wrong I

avatar
Chaya
0 1 0 9
asked 07 September, 2021
64 votes
28 answers
2.7K views
How can I safely create a nested directory in Python?

What is the most elegant way to check if the directory a file is going to be written to exists, and if not, cr

avatar
Dorian
0 1 0 9
asked 07 September, 2021
53 votes
21 answers
2.2K views
jQuery Ajax error handling, show custom exception messages

Is there some way I can show custom exception messages as an alert in my jQuery AJAX error message? For examp

avatar
Cortez
0 1 0 9
asked 07 September, 2021
63 votes
30 answers
1.6K views
How do you assert that a certain exception is thrown in JUnit 4 tests?

How can I use JUnit4 idiomatically to test that some code throws an exception? While I can certainly do somet

avatar
Hallie
0 1 0 9
asked 07 September, 2021
50 votes
30 answers
2.6K views
Avoiding NullPointerException in Java

I use object != null a lot to avoid NullPointerException. What is an alternative to: if (someobject != null) {

avatar
Serina
0 1 0 9
asked 07 September, 2021