Hi folks,
i'm trying to send back a simple error message as Json, with the HTTP code as 404.
So i started out writing my own IExceptionFilter that checks to see the exception. To keep this simple, if the exception throw is of type ResourceNotFoundException then i set the code to 404. Otherwise everything else if 500.
Now, the problem ...
How do I do exception handling in a procedural language like C or Perl? (I know Perl also does OO.) What’s the best way to handle exception in procedural code in Perl?
...
I have a WPF application that spins off several threads. I have defined a DispatcherUnhandledException event handler in App.xaml.cs that displays a detailed error message, and this handler gets called every time the UI thread encounters an exception. The problem is with the child threads: their unhandled exceptions never get handled. How...
Let's say in one method I have
try {
callme();
}
catch
{
// handle callme exception
}
Now let's say callme() calls method1() which in turn calls method2() --
If method2() throws an exception should it get thrown back to method1()'s frame, which will then stop any further execution inside of itself and pass the exception thrown from m...
In Tomcat, I wrote a ServletContextListener which will start an ExecutorService during startup and terminate it when it is unloaded.
I am following the example in the javadoc for ExecutorService
public void contextDestroyed( ServletContextEvent sce )
{
executor.shutdown();
try
{
executor.awaitTermination( 50, TimeUn...
What is the order in which exception handling stack frames are pushed onto the call stack in say C#. If i have a method:
private void MyMethod() {
try {
DoSomething();
}
catch (Exception ex)
{
//Handle
}
}
Is a separate stack frame created for each exception handler as follows?
DoSomething stackframe<br/>
Exceptio...
In Global.asax, is there a way to handle SQL Timeouts elegantly, and display a message on the requesting page explaining the error? I know Global.asax has the Application_Error and Error events, but I'm not sure which (if any) I could use to accomplish this.
Related, can I access the page instance which raised the error that Global.asa...
I'm want to get an idea how I should handle end-user visible error messages in my web application.
How much information do you give in
error messages?
Do you redirect all errors,
regardless of type, to a common error
page, or do you have a small set of pages (404, 403, all others)?
Do you give error codes that the user
could reference/...
This question covers a broad range of programming languages; however, I am specifically working with Python in this case.
I would like to create some user defined exceptions, but I'm not sure how fine-grained they should be. For example, if I have the following class:
class Race(object):
def __init__(self, start_time, end_time):
...
I am working on a library designed to communicate (over RS232 serial communication) with external devices. I was thinking about error handling strategy and exceptions seemed to be right and industry standard way of reporting errors.
So I read few guidelines on exceptions. One pretty clearly states that I should not worry about performan...
I am trying to find out the best way of handling exceptions, I have a number of layers to my application and started to use a return type of BOOL i.e. if it fails then return False and if it succeeds return True..
This works great in methods like SaveMyRecord(somerecord); as i am passing in values and don't require anything returned so...
Hi,
I have a bug somewhere that is causing my app to just vanish without an error message or something like that. The app just dissapears from the screen and it's no longer listed on the Task Manager.
The app is a C++Builder app (CBuilder2007), and I have tried everything I have think of to try to catch this error. It happens very very...
This question is not a technical but a historical one. I was just thinking today that I've also thought of Java as the "first" language to use exception handling, until I realized that my reason for thinking this way is probably because Java was the first language I encountered that used it, but I had no historical data to back up that c...
.NET Programming guidelines state that we should not catch general exceptions. I assume the following code is not very good because of the general exception type catch:
private object CreateObject(string classname)
{
object obj = null;
if (!string.IsNullOrEmpty(classname))
{
try
{
...
The situation is that I have a dynamic library written in C++ that is wrapped for Python by another dynamic library, also written in C++ (generated by SIP to be specific). The first dynamic library defines a function do_raise, which throws an exception RaiserError, a subclass of std::exception. The second dynamic library, in wrapping do_...
My intuitive response to this question would be ,"This is so stupid that I can't continue having this conversation." However:
Is there any way to hook all javascript function calls within my module? I'd like to find a convenient way of showing "loading blah...", "done..." messages when performing AJAX calls without having to explicitly ...
I have noticed during some actions in MVC, such as an Edit ActionResult, if the UpdateModel fails it places the exception in to the ModelState, if I go through the collection I can find the exception.
However there is no StackTrace information.
So I have a few questions
1, How do I catch ModelState exceptions, in a generic way (ie on...
Hi,
sometimes, under not reproducible circumstances, my WPF application crashes without any message. The application simply close instantly.
Where is the best place to implement the global Try/Catch block. At least i have to implement a messagebox with: "Sorry for the inconvenience ..."
Any help would be most welcome, thank you.
...
From a class extending java.beans.PropertyEditorSupport :
/**
* Sets the property value by parsing a given String. May raise
* java.lang.IllegalArgumentException if either the String is
* badly formatted or if this kind of property can't be expressed
* as text.
*
* @param text The string to be parsed.
*/
public void setAsText(...
My problem relates to the other question I have asked about loading image from the URL.
The code below works.
However, I have encountered the problem if I try to get the image (it suppose be there) but
apparently was removed. The application does not know and returns the error.
Is there a way to prevent it by capturing incoming error. ...