An exception is a rarely occurring (exceptional!) condition that requires deviation from the program's normal flow. Normally, an exception should not result in total failure, but instead be attended by an exception handler. Exception handling is a built-in construct in many programming languages. ...
4
votes
1answer
42 views
How to make try-except-KeyError shorter in python?
Very often I use the following construction:
try:
x = d[i]
except KeyError:
x = '?'
Sometimes, instread of '?' I use 0 or None. I do not like this construction. It is too verbose. Is there ...
0
votes
1answer
19 views
Jframe Program giving exception on run
My Code
import java.awt.*;
import javax.swing.*;
// Create a simple GUI window
public class TopLevelWindow {
private static void createWindow() {
//Create and set up the window.
...
1
vote
1answer
45 views
Why doesn't Catch Print?
try {
Thread.sleep(1000);
} catch(InterruptedException e) {
System.out.println("Interrupted, NOT PRINTED");
}
System.out.println ("This statement is printed");
in this code sleep throws an ...
0
votes
3answers
20 views
Error: catch parameter is not a pointer to an interface type iOS
I'm trying to use Exception handling in my Xcode project.
- (void)viewDidLoad
{
[super viewDidLoad];
authenticate = [[UseDb alloc]init];
@try{
[authenticate createDatabase];
}
...
0
votes
0answers
39 views
python logging don't catch exceptions
When I try and use python's logging module, it seems to catch exceptions and print out an error instead of allowing the program to crash normally.
To initialize the logging I have this:
...
2
votes
3answers
66 views
What exactly happens when there is an exception [closed]
This may be a very simple question,but just want to understand what exactly happens when there is an exception ,Is there a memory leak while doing operations in the memory or what is it.This is not ...
0
votes
3answers
16 views
Is assert in privation function redundant if check has already been made by the calling public function?
Effective java states a good practice of assertions in private methods.
"For an unexported method, you as the package author control the circumstances under which the method is called, so you can and ...
0
votes
4answers
49 views
Java pointer exception
I'm trying to traverse an array of Student objects in my main function class but am getting the following error
Exception in thread "main" java.lang.NullPointerException
at ...
1
vote
1answer
16 views
why isn't sys.exc_info() reverting to None?
The behavior of sys.exc_info() is described in python docs and on SO and SO as:
within an except block or methods called by an except block, a triple describing the exception
elsewhere, a triple of ...
0
votes
1answer
26 views
NSMutableDictionary with two keys pointing to same object causing “double free” exception
So I'm trying to make a dictionary with objects that each have two keys pointing to them. I have written this block to set the objects:
ALAssetsGroupEnumerationResultsBlock resultsBlock = ^(ALAsset ...
0
votes
1answer
10 views
Rails 3 + Exception notifier: How do I use exception notifier for rake tasks?
So in the old plugin for Rails 2 there used to be a method called notifiable that I could use to surround whatever Rake task I needed to attach exception notifier to. However, when I try to run my ...
0
votes
1answer
7 views
Customize communication of an Exception message to user without using “echo” in catch block?
There are many questions that address whether to use exceptions as user messages, and it seems that there are solid adherents to both the yes and no factions and I don't want this question to add to ...
1
vote
2answers
17 views
Visual Studio not breaking on user-unhandled exceptions
When running my app in Visual Studio, it's ending on unhandled exceptions rather than showing a message box with the exception info and continuing on as I'm accustomed to.
What options do I need to ...
-3
votes
1answer
41 views
c++ catch catch bad_alloc and delete pointer
i have the following function and my problem is that i can't delete temp in the catch because it says that temp is undeclared but i don't understand why? any help is appreciated.
...
0
votes
0answers
5 views
Save file with filter using
I would like to save names into txt file. This names conatins (age, address, mother's name etc.), but i would like to save that names into txt file, who's age is 20. How looks like the code for it?
...