tagged [exception]

What causes a java.lang.ArrayIndexOutOfBoundsException and how do I prevent it?

What causes a java.lang.ArrayIndexOutOfBoundsException and how do I prevent it? What does `ArrayIndexOutOfBoundsException` mean and how do I get rid of it? Here is a code sample that triggers the exce...

Throwing a Win32Exception

Throwing a Win32Exception I've been writing a lot of code recently that involves interop with the Win32 API and have been starting to wonder what's the best way to deal with native (unmanaged) errors ...

29 Apr at 08:57

Handling a timeout error in Python sockets

Handling a timeout error in Python sockets I am trying to figure out how to use the and to handle a socket timeout. ``` from socket import * def main(): client_socket = socket(AF_INET,SOCK_DGRAM) ...

How do I check if a variable exists?

How do I check if a variable exists? I want to check if a variable exists. Now I'm doing something like this: Are there other ways without exceptions?

9 Apr at 09:48

jQuery Ajax error handling, show custom exception messages

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 example, if I want to throw an except...

31 Mar at 09:10

Catch exception and continue try block in Python

Catch exception and continue try block in Python Can I return to executing the `try` block after exception occurs? For example: vs.

27 Mar at 22:10

What is the intended use of the optional "else" clause of the "try" statement in Python?

What is the intended use of the optional "else" clause of the "try" statement in Python? What is the intended use of the optional `else` clause of the `try` statement?

22 Mar at 18:15

What is a good way to handle exceptions when trying to read a file in python?

What is a good way to handle exceptions when trying to read a file in python? I want to read a .csv file in python. - - Is there a prettier way to do it?

27 Feb at 20:32

Handling two WebException's properly

Handling two WebException's properly I am trying to handle two different `WebException`'s properly. Basically they are handled after calling `WebClient.DownloadFile(string address, string fileName)` A...

17 Feb at 12:21

Proper way to declare custom exceptions in modern Python?

Proper way to declare custom exceptions in modern Python? What's the proper way to declare custom exception classes in modern Python? My primary goal is to follow whatever standard other exception cla...

9 Feb at 10:34

How to log formatted message, object array, exception?

How to log formatted message, object array, exception? What is the correct approach to log both a populated message and a stack trace of the exception? I'd like to produce an output similar to this: `...

4 Feb at 13:12

Elegantly handle task cancellation

Elegantly handle task cancellation When using tasks for large/long running workloads that I need to be able to cancel I often use a template similar to this for the action the task executes: ``` publi...

3 Dec at 01:37

Rethrowing previous exception inside ContinueWith

Rethrowing previous exception inside ContinueWith ###Intro After puzzling over my code for a while, I discovered that exceptions don't propagate through `ContinueWith`: In this

18 Nov at 10:49

How to exclude specific exception types from Serilog?

How to exclude specific exception types from Serilog? I am using Serilog to log information about an `asp.net core 2.1` application hosted on IIS. When exceptions occur, I am informed by email. The th...

15 Nov at 20:18

What is a watson information/bucket?

What is a watson information/bucket? I was reading [Microsoft document on ExceptionDispatchInfo Class](https://msdn.microsoft.com/en-us/library/system.runtime.exceptionservices.exceptiondispatchinfo(v...

How to avoid a "object reference not set to an instance of an object" exception in XAML code at design time?

How to avoid a "object reference not set to an instance of an object" exception in XAML code at design time? I have a problem with a wpf usercontrol which is of my own devising. The problem is that I ...

30 Oct at 07:47

How can I handle the warning of file_get_contents() function in PHP?

How can I handle the warning of file_get_contents() function in PHP? I wrote a PHP code like this But when I remove "http://" from `$site` I get the following warning: > Warning: file_get_contents(ww...

Declare a method that always throws an exception?

Declare a method that always throws an exception? I have a method like: This produces a compiler error, "not all code paths return a value". But in my case ThrowSpecificFault() will always throw (the ...

4 Oct at 09:57

InvalidCastException for two Objects of the same type

InvalidCastException for two Objects of the same type I have this weird problem that I cannot handle myself. A class in the model of my mvp-project designed as singleton causes an `InvalidCastExceptio...

What is a StackOverflowError?

What is a StackOverflowError? What is a `StackOverflowError`, what causes it, and how should I deal with them?

How to see exception detail in debugger without assigning variable to exception?

How to see exception detail in debugger without assigning variable to exception? I want to see exception detail in visual studio debugger without assigning variable to exception. Currently I have to w...

20 Jul at 14:53

What is the proper way to rethrow an exception in C#?

What is the proper way to rethrow an exception in C#? Is it better to do this: Or this: Do they do the same thing? Is one better than the other?

11 Jul at 22:18

Catch a thread's exception in the caller thread?

Catch a thread's exception in the caller thread? I'm very new to Python and multithreaded programming in general. Basically, I have a script that will copy files to another location. I would like this...

5 Jul at 13:41

How can I throw an exception in C?

How can I throw an exception in C? I typed this into Google, but I only found how-tos in C++. How can I do it in C?

10 Jun at 12:20

How can I solve "java.lang.NoClassDefFoundError"?

How can I solve "java.lang.NoClassDefFoundError"? I've tried both the examples in Oracle's [Java Tutorials](http://docs.oracle.com/javase/tutorial). They both compile fine, but at run time, both come ...