We're trying to throw our own custom exception on the server side and handle it on the client to show specific error messages.
Currently all we get is InvocationException & StatusCodeException on the client. Is there a better way to get our own custom exceptions propagated to the client side.
Also, we do not want to declare "throws" de...
Hello,
If I use a try/catch and display a messagebox,I can only see the exception but the VS IDE does not point me to the Exact LINE...(although I get the name of the function and stacktrace)
Is there anyway to throw the exception back on the exact line during debugging without removing the try / catch blocks?
Thanks
...
I know it's evil, but I've seen swallowed exceptions in code written by a good programmer. So I'm wondering if this bad practice could have at least one positive point.
In other words, it is bad but why do good programmers, on rare occasions, use it?
try
{
//Some code
}
catch(Exception){}
...
Can exceptions be caught inside a using block, and if so what is the syntax?
So, something like the following:
using (var creatingThing = new MyCreatingThing())
{
creatingThing.CreateSomething();
catch()
{
creatingThing.Rollback();
}
}
Can this be done? Or do I need to write this code manually (ie without a ...
If CStdioFile::Open fails, I want to be able to report the cause of the error.
However, it appears as though it never throws an exception. Also, when I try the following:
CStdioFile file;
CFileException exc;
bool bSuccess = (file.Open(_T("FileDNE"), _O_RDONLY, &exc) == TRUE);
ASSERT_FALSE(bSuccess);
CString err;
exc.GetErrorMessage(e...
Hello:
Background:
I have a custom user control based around a WPF TreeView. I've been using the MVVM pattern and have a base view model TreeNode class and several derived view models such as LocationNode, LocationFolder, PersonNode, PersonFolder, CollectionNode, CollectionFolder, etc..
A example of how the tree might be laid out is:
...
Background: Hibernate connects to a database using a username and password entered into a GUI. Upon failure, instead of propagating the error up as an exception, it comes out as a stack trace in the logger. I don't know where the exception is being caught at. Also a tiny bit troubling is the following block:
if (reason != null) {
...
hello
I have changed title slightly because I thought this is more appropriate question.
Would you refactor it (seems like legitimate use of goto) ?
If, how would you refactor the following code to remove go to statement?
if (data.device) {
try {
...
}
catch(const std::exception&) { goto done; }
... // more t...
Hi all,
I have several asynchronous jobs that I would like to transparently handle the exception for. I'd like to put the exception handling logic in another component / class. With Seam 2, I extended an exception handler class.
For instance, I'd like to raise an event with the exception in it so that I can have several components ac...
Hi all. I'm trying to make my exception notification a bit smarter. Currently, if i have a bad resource link such as a misnamed javascript file referred to in a file link tag, it triggers a "No route matches" error. I also get a "No route matches" error if someone just types some random url (eg when trying to hack the site). I'm tryi...
This question has been asked before and there have been windows-specific answers but no satisfactory gcc answer. I can use set_terminate() to set a function that will be called (in place of terminate()) when an unhandled exception is thrown. I know how to use the backtrace library to generate a stack trace from a given point in the progr...
Hello, all.
Seeing a checked expection in API is not rare, one of the most well known examples is IOException in Closeable.close(). And often dealing with this exception really annoys me. Even more annoying example was in one of our projects. It consists from several components and each component declares specific checked exception. The...
using(SomeClass x = new SomeClass("c:/temp/test.txt"))
{
...
}
Inside the using block, all is fine with treating exceptions as normal. But what if the constructor of SomeClass can throw an exception?
...
How can I get the full stack trace from the Exception object itself?
Consider the following code as reduced example of the problem:
last_exception = None
try:
raise Exception('foo failed')
except Exception as e:
last_exception = e
# this happens somewhere else, decoupled from the original raise
print_exception_stack_trace(last_...
Hi, i would like to know if there is a Way that when an exception is thrown to let the program continue aftare the exception was thronw for example
try
line 1
line 2
line 3
line 4 ( here the exception is throw and jumps to the catch)
line 5 <-- i would like the program to continue its execution after lo...
If been looking around the web and can't seem to find any good solutions to sending allowing your user to submit bug reports from your iPhone app.
How do you handle crashes and exceptions?
Do you send the error user-data to a server,
grab a log file from somewhere and attach,
or do you ignore it and pretend it never happened?
Anybod...
please verify me if I am right: when a program encounters a exception we should write code to handle that exception, the handler should do some recovery job, like rerun the program, but is not just telling us where we went wrong in real world application.
...
I have repeatedly found myself in situations where I want to catch an exception (in .net), but there may be multiple exceptions with different messages that I want to handle differently.
When I view the exception in a debugger, I usually cannot find any piece of metadata that shows me a unique number representing that particular excep...
In .net the AggregateException class allows you to throw an exception containing multiple exceptions.
For example, you would want to throw an AggregateException if you ran multiple tasks in parallel and some of them failed with exceptions.
Does java have an equivalent class?
The specific case I want to use it in:
public static void r...
I have a weird error when try to redirect a exception to STDERR.
I have a script that is use to load several "plugins", working as main entry program. The plugins do stuff like connect to databases, parsing text data, connect to web services, etc...
Is like this:
try:
Run plugins here...
#All was ok!
print "...