Questions tagged [unhandled-exception]

An unhandled exception is an Exception that is thrown by execution but is never caught by the program, which results in a Exception Stack.

An unhandled exception is an Exception that is thrown by execution but is never caught by the program, which results in a Exception Stack.

This could be avoided by catching the exception in a try-catch statement, but it is not always appropriate to catch every possible exception. Sometimes the exception is the result of the client making a mistake rather than something that occurred where it is thrown, therefore the client should be informed of the exception. Most of the time however, it is user friendly to not propagate exceptions.

Read more here.

762 questions
308
votes
9 answers

What is an unhandled promise rejection?

For learning Angular 2, I am trying their tutorial. I am getting an error like this: (node:4796) UnhandledPromiseRejectionWarning: Unhandled promise rejection (r …
232
votes
7 answers

Java 8: How do I work with exception throwing methods in streams?

Suppose I have a class and a method class A { void foo() throws Exception() { ... } } Now I would like to call foo for each instance of A delivered by a stream like: void bar() throws Exception { Stream as = ... as.forEach(a ->…
Bastian
  • 4,638
  • 6
  • 36
  • 55
229
votes
5 answers

How to find which promises are unhandled in Node.js UnhandledPromiseRejectionWarning?

Node.js from version 7 has async/await syntactic sugar for handling promises and now in my code the following warning comes up quite often: (node:11057) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1):…
user1658162
  • 2,721
  • 2
  • 19
  • 23
134
votes
2 answers

Why is UnhandledExceptionEventArgs.ExceptionObject an object and not an Exception?

Why is UnhandledExceptionEventArgs.ExceptionObject an object and not an Exception? I am attaching to AppDomain.UnhandledException. I would like to cast UnhandledExceptionEventArgs.ExceptionObject to an Exception and interogate it. And with this in…
Simon
  • 33,714
  • 21
  • 133
  • 202
133
votes
8 answers

Why is "throws Exception" necessary when calling a function?

class throwseg1 { void show() throws Exception { throw new Exception("my.own.Exception"); } void show2() throws Exception // Why throws is necessary here ? { show(); } void show3() throws Exception //…
nr5
  • 4,228
  • 8
  • 42
  • 82
126
votes
5 answers

catch all unhandled exceptions in ASP.NET Web Api

How do I catch all unhandled exceptions that occur in ASP.NET Web Api so that I can log them? So far I have tried: Create and register an ExceptionHandlingAttribute Implement an Application_Error method in Global.asax.cs Subscribe to…
Joe Daley
  • 45,356
  • 15
  • 65
  • 64
115
votes
12 answers

Visual Studio 2015 break on unhandled exceptions not working

Visual studio used to have a specific checkbox to "Break on Un-handled exception". In 2015 this has been removed (or moved somewhere I cannot find it). So now my converted projects no longer break if I fail to provide a user-level exception…
Ted Lowery
  • 1,535
  • 2
  • 13
  • 8
94
votes
4 answers

How can I make something that catches all 'unhandled' exceptions in a WinForms application?

Up until now, I just put a try/catch block around the Application.Run in the Program.cs entry point to the program. This catches all exceptions well enough in Debug mode, but when I run the program without the debug mode, exceptions don't get…
Isaac Bolinger
  • 7,328
  • 11
  • 52
  • 90
75
votes
5 answers

Unhandled exceptions in BackgroundWorker

I have a small WinForms app that utilizes a BackgroundWorker object to perform a long-running operation. The background operation throws occasional exceptions, typically when somebody has a file open that is being recreated. Regardless of whether…
Andy
  • 821
  • 2
  • 7
  • 8
65
votes
4 answers

ValueError: Dependency on app with no migrations: customuser

I am trying to start a webpage using the Django framework. This is my first web development project. After creating the project, I tried to start an app that utilizes customized users and registration with email validation using…
53
votes
5 answers

How can I set up .NET UnhandledException handling in a Windows service?

protected override void OnStart(string[] args) { AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); Thread.Sleep(10000); throw new Exception(); } void…
Mike Pateras
  • 14,715
  • 30
  • 97
  • 137
47
votes
14 answers

Dart Unhandled Exception: FormatException: Invalid radix-10 number (at character 1)

I am trying to fetch some Data from the internet. So I made a API Request for a weather website. But I am getting the following exception- Unhandled Exception: FormatException: Invalid radix-10 number (at character 1). This is the error Code: …
Tom
  • 503
  • 1
  • 4
  • 8
38
votes
9 answers

Is there a way to globally catch all unhandled errors in a Blazor single page application?

I would like to be able to catch all unhandled exceptions in one single place building a Blazor single page application. Like using the "Current.DispatcherUnhandledException" in WPF applications. This question is exclusively about client-side…
TroelsGP
  • 541
  • 1
  • 5
  • 12
33
votes
3 answers

c++ stack trace from unhandled exception?

This question has been asked before and there have been windows-specific answers but no satisfactory gcc answer. I can use set_terminate() to set a function that will be called (in place of terminate()) when an unhandled exception is thrown. I know…
c-urchin
  • 4,344
  • 6
  • 28
  • 30
29
votes
3 answers

Difference between UnhandledException and DispatcherUnhandledException in .NET

What is the difference between AppDomain.UnhandledException and Application.DispatcherUnhandledException in .NET? I need an event that is fired when any unhandled exception occurs. I have come across these two, but I dont know in what ways they…
user246392
  • 2,661
  • 11
  • 54
  • 96
1
2 3
50 51