All Questions
Tagged with error-handling try-catch
812
questions
0
votes
2
answers
33
views
When will a laravel model creation fail without an exception?
I am adding a store method to a controller that will create and save a new model to the database using the following code:
public function store(Request $request)
{
$validated = $request->...
0
votes
0
answers
25
views
Catch block not catching file load faillure when file is blocked by applocker / wdac
try
{
var appcontrolHeartbeat = new Class1();
}
catch (FileLoadException e)
{
log.Info(
$"...
-1
votes
2
answers
62
views
How to use try-catch in trigger
I want to prevent inserting data into a table and return 'Error' if 'OrderDate' column is greater than '2021-01-01'. How can I do this by the use of TRIGGER and TRY...CATCH in sql-server v.2019
...
2
votes
1
answer
35
views
Multiple async throws result in unhandled exception
I have an async method which in turn calls some other async methods which can throw errors.
The problem is that the try-catch only handles the first exception thrown.
I'm assuming that once a function ...
0
votes
0
answers
22
views
how to handle Power query sql connection error
In my scenario
I have multiple SQL connections in Power Query (Power BI)
Sometimes i have connection problems so auto-refresh gives error.
An error example is;
DataSource.Error: Microsoft SQL: A ...
-1
votes
1
answer
36
views
try-catch: My question is: when an error happens in my try-block, the catch-block handles it, but the rest of the program crashes
The issue is that when an exception occurs in the try block, the catch block handles it flawlessly, but after managing it, the application crashes, which is the primary objective of the try-catch ...
0
votes
1
answer
234
views
getting api routes in NextJs (App router) to respond with JSON {ok:false} when an error is thrown
I use fetch() api routes to populate my dashboard page with data. During development I adopted a plan to use try {} catch {} blocks to handle and catch errors, and then pass the error message to a ...
0
votes
1
answer
28
views
How to catch error in XMLHttpRequest call with caller function
I am building a feature in ReactJS that allows a user to upload files to a photos app. My backend validates the files to ensure they are of a supported type, and not some random type like .txt or ....
0
votes
1
answer
63
views
Trap error from Get-Childitem when access to directory is denied
I'm trying to trap errors using a try/catch block with Get-Childitem but it isn't working. Here is an excerpt of my code:
if((Test-Path .\test.txt)){
$key = Get-Content -Path .\test.txt
} else {
...
0
votes
2
answers
25
views
Changing exception type in NestJS
In my architecture I have a repository get function that makes a database request in a try-catch block and returns not found exception if no user exists. In a login function, I invoke the repository ...
-1
votes
1
answer
59
views
How to handle errors and messages without raising exception? (pythonic way)
I have a program which has a lot of functions inside. And all this functions calls another functions. This functions has try catch blocks for to handle errors. I have to handle this errors without ...
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 ...
0
votes
0
answers
39
views
.NET Avoid exception middleware to handle specific exception (stripe)
The Problem
I have a method that essentially assigns an account a specific role, and then creates a Stripe account for the user. The issue is if the Stripe method throws an exception, the middleware ...
0
votes
0
answers
15
views
How to forward an exception caught in 2 route to 1 route in apache camel
I configured 2 routes A & B using Apache Camel. When I try to hit route A it will generate an XML template as a response which I forward to route B. In both routes, I have declared try-catch ...
1
vote
0
answers
41
views
Capturing and Logging MySQLI Errors in PHP within Try-Catch Blocks [duplicate]
I made a error log for collecting errors. I'm trying to catch all the errors in my log file but it won't collect any errors. I tried making an error on purpose to see if it does work but I checked the ...