Linked Questions
30 questions linked to/from Why should I not wrap every block in "try"-"catch"?
-1
votes
1
answer
322
views
Why is objective-c exception unfriendly? [duplicate]
I used to work in .NET c# and recently I started learning objective-c and iOS programming. Several times I've read that objective-c is exception unfriendly and I shouldn't handle them. I know it's ...
-2
votes
1
answer
87
views
Regarding java's try/catch syntax; are these blocks equivalent? [duplicate]
In the following block:
try (final InputStream fis = new BufferedInputStream(Files.newInputStream(f.toPath()));
final ArchiveInputStream ais = factory.createArchiveInputStream(fn, fis)...
99
votes
10
answers
51k
views
How expensive are exceptions in C#?
How expensive are exceptions in C#? It seems like they are not incredibly expensive as long as the stack is not deep; however I have read conflicting reports.
Is there definitive report that hasn't ...
53
votes
12
answers
64k
views
How to know the exact line of code where an exception has been caused?
If I generate an exception on my own, I can include any info into the exception: a number of code line and name of source file. Something like this:
throw std::exception("myFile.cpp:255");
But what's ...
64
votes
7
answers
38k
views
Is it a known good practice to use a big try-catch per method in java? [closed]
I've been interviewed recently and the interviewer wanted me to do a technical test to see my knowledge. After I finished it he gave me feedback about how I did it, which I didn't expect and I ...
69
votes
6
answers
36k
views
Why is `.catch(err => console.error(err))` discouraged?
I'm using promises and have code that looks like the following:
function getStuff() {
return fetchStuff().then(stuff =>
process(stuff)
).catch(err => {
console.error(err);
});
}
...
34
votes
10
answers
30k
views
Call-stack for exceptions in C++
Today, in my C++ multi-platform code, I have a try-catch around every function. In every catch block I add the current function's name to the exception and throw it again, so that in the upmost catch ...
28
votes
5
answers
19k
views
Why doesn't C++ use std::nested_exception to allow throwing from destructor?
The main problem with throwing exceptions from destructor is that in the moment when destructor is called another exception may be "in flight" (std::uncaught_exception() == true) and so it is not ...
12
votes
5
answers
30k
views
Assert in try catch block
I am currently adding handling to a segment of code so that it will not crash. Currently it has each step then an ASSERT statement to make sure nothing went wrong in the previous step. If something ...
8
votes
5
answers
9k
views
VBA Error "Bubble Up"
I haven't read much about it, but the author at the link below recommends that I don't use "bubble up" to centralize error handling in VBA.
Excel Programming Weekend Crash Course via Google Books
...
13
votes
3
answers
8k
views
lexical_cast int to string
Is it safe to ignore exception of boost::lexical_cast when converting int to std::string?
7
votes
6
answers
6k
views
Correct way to initialize dynamic Array in C++
I'm currently working on a C++ project, where dynamic arrays often appear.
I was wondering, what could be the correct way to initialize a dynamic array using the new-operator? A colleague of mine told ...
10
votes
7
answers
3k
views
Is catching NumberFormatException a bad practice?
I have to parse a String that can assume hex values or other non-hex values
0xff, 0x31 or A, PC, label, and so on.
I use this code to divide the two cases:
String input = readInput();
try {
...
4
votes
1
answer
7k
views
value isDefinedAt is not a member of play.api.mvc.SimpleResult
the following code is giving error, and i dont know whats the reason, and how remove this error, tell me what i am doing wrong.
def members(id:String,name:String) = Action { implicit request =>
...
3
votes
3
answers
780
views
Is it necessary to wrap every exception at top level?
Today, someone told me that we should always wrap every exception at the top level of the framework.
The reason is the original exception may contains sensitive information in the stacktrace or ...