Questions tagged [error-handling]
Programming language constructs designed to handle errors signaled by error codes, exceptions or other language specific means.
error-handling
8,700
questions with no upvoted or accepted answers
17
votes
1
answer
1k
views
How to access non-localized description of Error?
It seems that the Error type in Swift provides only one property, localizedDescription. My app will be running on machines set to other languages than English. I would like to write error reports (for ...
15
votes
1
answer
18k
views
NextJS best practice for handling "Server Error" and "Client side error"
Using NextJS, I see 2 kinds of errors:
Server Error
generated it using throw new Error(...) inside getInitialProps...
it can occur due to some business logic or unexpected API response;
screenshot:
...
15
votes
1
answer
1k
views
Error: Permission denied to access property 'target'
How do I determine if the subsequent code has permissions in order to avoid the following error message:
Error: Permission denied to access property 'target'
This happened in Firefox within an event ...
14
votes
2
answers
589
views
Why can't the compiler optimize a single throw statement in a try-catch block?
I was just playing around with some C++ code at Compiler Explorer and noticed some unexpected behavior when compiling a simple try/catch block. Both of the following snippets were compiled with gcc ...
14
votes
0
answers
3k
views
How to catch *all* errors and exceptions with Sentry?
Out of 24 errors that appear in the console of my page in Chrome, Sentry only records one.
I have followed the documentation and ensured that Sentry is loaded and initialized in the <head> of ...
13
votes
4
answers
7k
views
nextjs - use _error.js in dev mode
So I am creating a custom error page on my nextjs application.
Following the documentation, I created a _error.js file with my view in it (in React)
My issue is when I am in dev mode, my _error page ...
12
votes
1
answer
4k
views
ReferenceError: document is not defined in bg.js file when migrating chrome extension to MV3
I am migrating my chrome extension code from Manifest V2 to V3. However, I get a "ReferenceError: document is not defined" in line 9 of my bg.js file. Does anyone recognize why? It worked ...
10
votes
2
answers
3k
views
How Apache camel error handling works with multicast and transactions
I got spring boot (2.3.2.RELEASE) with camel (3.5.0) application and two routes for testing in it:
The idea is to check what happen when exception occurred in child route that was called from ...
9
votes
1
answer
448
views
Next.js 13+ How to test global-error.tsx during development
I added global-error.tsx file to the Next.js project v 13.4.16.
I am wondering how I can simulate it to see how this looks like in UI during development.
I keep my global-error.tsx file on the same ...
9
votes
0
answers
958
views
Failed to write manifest file.Error Domain=NSCocoaErrorDomain
I have react native expo app with Sentry configured. Sentry is reporting this crash.
Error: Failed to write manifest file.Error Domain=NSCocoaErrorDomain Code=640 "You can’t save the file “...
9
votes
0
answers
3k
views
Error handling for URLSession.shared.datatask
I have a function that queries an API and then populates an array of objects based on the results(see code below). From the JSON retrieved I can use guard statements to catch any error meaning that if ...
9
votes
0
answers
2k
views
Firebase Authentication Error Handling
Not sure if this is somewhere already, but I couldn't find it so I made it. Hope this provides help to someone. Steps that you have to follow:
Step #1 Put the guard statement after you try to login
...
9
votes
2
answers
254
views
Logging caught errors exactly the same as uncaught errors in Node.js
Let's say I have the following file error.js:
// this is invalid code
var a: 0;
And then in my main.js I require that file:
require("./error.js");
I get a nice, simple, and easy to understand ...
8
votes
0
answers
563
views
How to display a pretty error with apollo link error
I've a problem with apollo-link-error, I'm able to log the error but I would like show a modal with the error or display it on another page, is it possible without handling the error on each request ?
...
8
votes
0
answers
261
views
<httpErrors> tag - respect tilde (~) or similar?
Using the old <customErrors> tag in web.config files, it was possible to write;
<customErrors mode="RemoteOnly" defaultRedirect="~/ErrorPage/">
<error statusCode="500" redirect="~/...