try-catch Questions
4
Solved
BEGIN TRY
EXEC N'EXEC sp_testlinkedserver N''[MyLinkedServer]'';';
END TRY
BEGIN CATCH
SELECT 'LinkedServerDown' AS Result
RETURN
END CATCH
SELECT TOP(1) FirstName FROM [MyLinkedServer].TestData...
Ginsburg asked 14/10, 2015 at 16:20
3
Solved
I am trying to build a wrapper over Notion JS SDK's iteratePaginatedAPI that handles errors as well. I feel particularly lost on how do I catch API errors in such a way that I can actually retry th...
Czernowitz asked 14/2, 2023 at 21:37
1
Solved
The following is a question about the performance of the ABAP TRY/CATCH construct. In particular, it is not about throwing or catching exceptions.
Is there a performance cost when entering TRY/CATC...
Regazzi asked 13/2, 2023 at 12:17
9
Solved
Is the following way to code good practice?
try {
//my code here
} catch (Exception e) {
logger.error("Some error ", e);
throw new MyCustomException("Some error ", e);
}
Moreover, should I.. ...
1
Solved
I have a code with a one-liner while and a try-except statement which behaves weirdly.
This prints 'a' on Ctrl+C:
try:
while True:
pass
except KeyboardInterrupt:
print("a")
and this t...
3
Solved
2
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...
Whitish asked 8/1, 2024 at 17:14
2
What I'm trying to do
Write a tryCatch that will handle an error value but will ignore a warning. As an example
foo <- function(x) {
if (x == 1) {
warning('Warning')
} else if (x == 0) {
s...
Abe asked 3/3, 2016 at 23:27
3
I have get network image and used ternary operator where I can show network image but unable to show default asset image where network image is invalid default image in grid also as this-
I am new ...
Frantic asked 9/1, 2021 at 4:35
9
Solved
Sometimes my code breaks and it is out of my control
How would I do the following?
try {
//do my stuff
}
catch {
//sleep and try again
}
The code isn't that much, so it's all one function, so ...
3
Solved
My idea is as follows:
I want to send multiple requests simultaneously without having to wait until priors execution.
So my pseudo code looks as follows:
function sleep(ms) {
return new Promis...
Exile asked 12/5, 2021 at 11:13
8
How can throw an error with options or a status code and then catch them?
From the syntax here, it seems we can through the error with additional info:
new Error(message, options)
So, can we throw...
Pagel asked 13/9, 2021 at 16:6
4
Solved
Currently I am working on code optimization where I am using try.. finally block to deference my objects.
But I have confusion that how returning an object is managed when I am creating null refer...
Susannesusceptibility asked 2/1, 2015 at 6:57
7
Solved
I have a try..catch block that looks like this:
try
{
...
}
catch (IOException ioEx)
{
...
}
catch (Exception ex)
{
...
}
I'd like to handle just a certain kind of IOException, namely a shar...
3
Solved
I want to do a Try Catch on an .exe in Powershell, what I have looks like this:
Try
{
$output = C:\psftp.exe ftp.blah.com 2>&1
}
Catch
{
echo "ERROR: "
echo $output
return
}
echo "DONE...
Countersignature asked 10/9, 2012 at 21:3
4
I want to write unit test for try catch block(C#).
Public ActionResult Index()
{
try
{
-------------
}
catch(Exception ex)
{
throw;
}
}
As you can see that i am using try-catch block in...
Amphibolite asked 14/4, 2014 at 7:1
7
Solved
Is there some way in Python to capture KeyboardInterrupt event without putting all the code inside a try-except statement?
I want to cleanly exit without trace if user presses Ctrl+C.
Francisfrancisca asked 17/11, 2010 at 14:24
11
Solved
I have a problem with my code in the try block.
To make it easy this is my code:
try:
code a
code b #if b fails, it should ignore, and go to c.
code c #if c fails, go to d
code d
except:
pass...
3
Solved
The biggest misunderstanding for me in Swift is the throws keyword. Consider the following piece of code:
func myUsefulFunction() throws
We cannot really understand what kind of error it will th...
8
Solved
In python how do you check if a function exists without actually running the function (i.e. using try)? I would be testing if it exists in a module.
Laddy asked 4/1, 2014 at 21:21
3
Solved
8
I can't understand exactly how return works in try, catch.
If I have try and finally without catch, I can put return inside the try block.
If I have try, catch, finally, I can't put return in the...
14
Solved
I need to catch some warnings being thrown from some php native functions and then handle them.
Specifically:
array dns_get_record ( string $hostname [, int $type= DNS_ANY [, array &$authns [...
Anthe asked 6/8, 2009 at 21:51
10
Solved
From my experience, a php server would throw an exception to the log or to the server end, but node.js just simply crashes. Surrounding my code with a try-catch doesn't work either since everything...
Madgemadhouse asked 14/5, 2011 at 2:4
6
Solved
I'm using the following script to use a database using PHP:
try{
$db = new PDO('mysql:host='.$host.';port='.$port.';dbname='.$db, $user, $pass, $options);
}
catch(Exception $e){
$GLOBALS['errors...
Wien asked 17/10, 2012 at 6:35
1 Next >
© 2022 - 2025 — McMap. All rights reserved.