error-handling

Should I Print the Exception Stack Trace?

How inefficient is it to get the stack trace for an exception? I know it's costly, but how costly? Should they definitely not be used in production environment? ...

C++ Error Handling -- Good Sources of Example Code?

Just about every piece of example code everywhere omits error handling (because it "confuses the issue" that the example code is addressing). My programming knowledge comes primarily from books and web sites, and you seldom see any error handling in use at all there, let alone good stuff. Where are some places to see good examples of C+...

General Business Object Practices (and exception errors - redux)

Recently, I made a post about the developers I'm working with not using try catch blocks properly, and unfortuantely using try... catch blocks in critical situations and ignoring the exception error all together. causing me major heart ache. Here is an example of one of the several thousand sections of code that they did this (some code...

ASP.Net MVC - handling bad URL parameters

What's the best way to handle a visitor constructing their own URL and replacing what we expect to be an ID with anything they like? For example: http://stackoverflow.com/questions/236349 But the user could just as easily replace the URL with: http://stackoverflow.com/questions/foo I've thought of making every Controller Function pa...

Error handling using Soap Headers

We are developing a new web service and are looking into the "best practice" for returning errors in the soap response. We were looking into creating a error response object which every response would contain as a property. This seems a little heavy however and are wondering if it is possible to use the SOAP header to carry this info...

I'm getting blank pages instead of error messages using classic ASP, IIS6 and WinServer 2003 R2

We have an old system running on a WinServer2003 R2 - IIS6 and it was written using classic ASP. We need to trap all errors and for that, I configured IIS to redirect 404s and 500s to a custom page (custom errors config) that writes the info to a log file (this page creates and manages the logs). Here is the weird thing: The first time...

How to cope with "disk full" scenarios?

The vast majority of applications does not handle "disk full" scenarios properly. Example: an installer doesn't see that the disk is full, ignores all errors, and finally happily announces "installation complete!", or an email program is unaware that the message it has just downloaded could not be saved, and tells the server to delete...

Display the call stack in a Delphi Win32 application

I'd like to display a stack trace in an error dialog in Delphi 2007 (Win32). Ideally, I'd like something like this: try //do something except on e : exception do begin //rollback a transaction or whatever i need to do here MessageDlg('An error has occurred!' + #13#10 + e.Message + #13#10 + ...

Best way to stop a JTree selection change from happening?

I have a dialog where each entry in a JTree has its corresponding options in a different panel, which is updated when the selection changes. If options for one of the entries is set to an invalid state, when the user attempts to change to a different entry in the tree, I want there to be an error dialog and have the selection not change....

jQuery Ajax error resolution

I'm working on a stripes app that uses a bit of jQuery to make the UI more dynamic/usable. I set up an Error Resolution, so if an error is thrown, the user is redirected to an error.jsp page. However, if an error is thrown during a jQuery Ajax call, instead of redirecting to the error.jsp page, I get html printed to the page where the ...

J2EE Error Handling - Application and User

Hi All, I have a question regarding handling errors in a J2EE application. Our current application is in use by many many users and as a result we get a lot of support tickets. Most of these tickets are user-related but 5-10% are system related exceptions, unhandled errors, etc. We have the basic exception handling checks in the code (...

When would I use uncaught_exception?

What is a good use case for uncaught_exception? ...

MS Access: How to bypass/suppress an error?

i am executing a query like this select field from table; here there is a loop running on many tables so if a field is not present in a table i get a runtime error 3061. how can i by pass this error such as that on this error flow should goto another point this is the code I have at present after goin through this forum Option Expl...

How to get the FTP error when using PHP

I have a script which logs on to a remote server and tries to rename files, using PHP. The code currently looks something like this example from the php.net website: if (ftp_rename($conn_id, $old_file, $new_file)) { echo "successfully renamed $old_file to $new_file\n"; } else { echo "There was a problem while renaming $old_file to $n...

How to get rid of try catch?

I'm bored with surrounding code with try catch like this.. try { //some boring stuff } catch(Exception ex) { //something even more boring stuff } I would like something like SurroundWithTryCatch(MyMethod) I know I can accomplish this behaviour by creating a delegate with the exact signature of the function, but creating a d...

Javascript error handling with try .. catch .. finally

I have a suspicion that I'm using the finally block incorrectly, and that I don't understand the fundamentals of its purpose... function myFunc() { try { if (true) { throw "An error"; } } catch (e) { alert (e); return false; } finally { return true...

ASP.NET logic / connection pooling and error handing

Hi I just uploaded my first ASP.NET (as part of my learning of vb.net) and got into awful mess with the connection pooling (funny things happen when there are more than 1 user of your web site) all sorted now by better use of the try catch statements (well the idea was to learn) BUT I was wondering if this is the best / final method, no...

Custom Errors for "App" folders? (ASP.NET)

Where can I setup custom errors for directories in my application such as App_Code, App_Browsers, etc.? I already have customErrors configured in the web.config and that works as expected. For example, http://www.mysite.com/bla.aspx > redirects to 404 page but http://www.mysite.com/App_Code/ > displays "The system cannot find the fi...

Unhandled Socket securityError even when (seemingly) handling it

I Have a problem where I occasionally (i.e. not always) see the below error popup from the Debug Flash Player after launching my app: Error #2044: Unhandled securityError:. text=Error #2048: Security sandbox violation: http://example.com/myApp.swf cannot load data from localhost:4499. at org.mydomain.mypackage::MyClassUsingSocket() ...

What are the best practices to log an error?

Many times I saw logging of errors like these: System.out.println("Method aMethod with parameters a:"+a+" b: "+b); print("Error in line 88"); so.. What are the best practices to log an error? EDIT: This is java but could be C/C++, basic, etc. ...