Skip to main content

Questions tagged [try-catch]

try-catch is a syntactic construct for catching exceptions raised by a code section

1 vote
0 answers
57 views

Why is my thread blocked by this try block?

So I am self-taught and green on handling requests, but it seems to me that in the case of no request body, the BufferedReader should output null if I call .readLine() again after running this kind of ...
T-Stone's user avatar
  • 11
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->...
Hoyt Jolly's user avatar
0 votes
1 answer
27 views

How do I get a try / exception statement to continue? [duplicate]

I need this to rerun the initial inpput question if it gets a value that is unacceptable. try: hours = float(input("Please enter your hours worked: ")) if hours < 1 : ...
Jennifer Sigler's user avatar
0 votes
1 answer
38 views

Appropriate way to handle exception in Java n-tier application

I have three layers in my application Controller, Service and DAO. My controller and service layers are in spring meanwhile DAO layer is in Hibernate 6. My question is what is most appropriate way to ...
Yasin Ahmed's user avatar
2 votes
0 answers
89 views

C++ sigbus error when trying to catch an exception

I have come across an interesting case, where C++ gives me a bus error, when I am trying to catch an exception. I created a minimal example to reproduce the error: #include <iostream> using ...
RolandSt's user avatar
-2 votes
0 answers
57 views

Ensuring a function is always called inside 'catch' block

I have a function which I always want to be called inside the 'catch' block of a try-catch statement. Is there any way in code to ensure it? Can we add some PMD checks or is it somehow possible ...
Python_user's user avatar
  • 1,511
0 votes
0 answers
29 views

Nested Try/Catch alternative [duplicate]

I have a need to attempt to convert a date from the registry to a [Datetime] so that I can do operations with it, and the date format is variable, because Autodesk. I also need to be able to throw ...
Gordon's user avatar
  • 6,693
0 votes
0 answers
30 views

How can I handle dead workers in R-future parallel processing

I want to fit multiple models to each participant in my data. I want to parallelize this by applying the fitting function in parallel to the data of multiple participants. For one of the models, the ...
FelixSchweigkofler's user avatar
1 vote
1 answer
73 views

How to get the current exception object in C++ Builder (replacement for ExceptObject)?

I am looking for a function/code that returns the current exception object. In other words, the exception object that represents the exception currently being handled (by the catch block). For example:...
Александр Кулагин's user avatar
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( $"...
Kim Oppalfens's user avatar
1 vote
2 answers
97 views

How to use try-catch (IOException) for BufferedWriter.write nested in if-else?

I have a block to write data(string) using BufferedWriter, but compiler keeps saying error: unreported exception IOException; must be caught or declared to be thrown this.dataContainer.stream()....
limestreetlab's user avatar
0 votes
1 answer
70 views

What does the variable declaration `const int *__errno_location ()` inside this catch statement actually do?

While working on an exercise for my C++ class where we were working on Exception handling, I came across a puzzling issue. I initially had the following exception handler (Please don't roast the use ...
Keheck's user avatar
  • 133
-2 votes
1 answer
74 views

Why did placing my file in a try catch with a FileNotFoundException work when reading a file? [duplicate]

I got my code to work for an assignment but it doesn't help me if I don't know why it happened so I am here to try and understand by asking the community. I am trying to read a simple text file with 3 ...
Vanni's user avatar
  • 14
0 votes
1 answer
53 views

Variables in Try-Catch blocks with Powershell?

I have been trying to write a script in powershell that renames a file if it does not get transferred correctly through WinSCP. The script looks something like this: # Variables $error = 0 $...
Evan's user avatar
  • 9
-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 ...
ArashVN's user avatar

15 30 50 per page
1
2 3 4 5
588