error-handling

How do you access the Source Error, Source File and Line Number of an exception to use in a custom error page?

Basically I want to take the following: And make it match the styling of the rest of the application. I am creating a custom error page in my C# based project and I want it to be able to show the same information that is displayed in the ASP.NET default error page. From fiddling with reflector I can see that this is generated through ...

Difference between IllegalAccessError and IllegalAccessException

Consider this pair of Throwable: IllegalAccessExceptionextends Exception Thrown when an application tries to reflectively create an instance (other than an array), set or get a field, or invoke a method, but the currently executing method does not have access to the definition of the specified class, field, method or constructor...

T-Sql Error Handling and Logging

Hi I am trying to maximize the benefits from an experience. Also I usually use Enterprise library logging block, I log errors and a portion of statistical information into the database, because it is centralized place to track errors, if database logging failed, Normally it goes to Event Log. Tracing messages should go into file: W...

Handling Active Resource Error

Hi. I have a simple question, and I am sure there is a standard answer to it; just can't find it. I have an ActiveResource user model in my rails app. It points to another rails app where my actual user entity lives. Everything in my app works fine while both apps are up. But when my back-end rails app is down; and I try to access activ...

VB6: does "On Error Goto 0" affect the error handler for the calling function?

If On Error Goto 0 is called in a VB6 Sub, will this switch off error handling even when control goes back to the calling Function/Sub? EDIT: If I have output in an error-handler block that is showing an error number of 0, what does that indicate? ...

window.onerror in Safari ( Javascript )

I create an error message its working with IE and Mozila. Not woking with Safari, Chrome and Opera. But I need to use it. Please give me right way for doing it. <script language="javascript" type="text/javascript"> window.onerror = function(msg, url, line) { document.write("Message\t = "+msg + "<br/>Location\t = " + url + "<br/>Lin...

Stream extraction within if/else

Assuming the stream extraction won't fail, will this if( !(stream >> token) ) throw runtime_error( "Unexpected end of recipe." ); else if( token == "something" ) // do something else throw runtime_error( "Unknown token" ); Work like this if( !(stream >> token) ) throw std::runtime_error( "Unexpected end of recipe." );...

ActiveResource error handling

Hi. I have been searching for a while and yet I am not able to find a satisfactory answer as yet. I have two apps. FrontApp and BackApp. FrontApp has an active-resource which mimics a model in BackApp. All the model level validations live in BackApp and I need to handle those BackApp validations in FrontApp. I have following active-res...

Concatenate tuples in empty dict

errors = {} #errorexample errors['id'] += ('error1',) errors['id'] += ('error2',) #works but ugly errors['id'] = ('error1',) errors['id'] += ('error2',) If 'error1' is not present it will fail. Do I really have to extend dict? ...

[PHP] Is there a way to redirect to an error page in register_shutdown_function ?

Hi all, I'm trying to find a clean way to handle fatal and critical errors (i.e. without output buffering), and I read that using HTTP headers in register_shutdown_function is impossible. The thing is, I'd like to redirect to a generic static error page when a critical error occurred (e.g.: service unavailable). How should I do ? D...

Any way to make PHP abort on unset/undefined variables and array indexes and such?

Currently, PHP would trigger (and log if logging is enabled) E_NOTICE 'errors' when accessing undefined variables and array indexes. Is there a way to make it abort on these, so that I know I don't miss any. Frankly, IMO, far too often a script SHOULD abort on such condition anyway, as it will inevitably break something farther down the ...

Error handling when importing modules

Hello people, This probably has an obvious answer, but I'm a beginner. I've got a "module" (really just a file with a bunch of functions I often use) at the beginning of which I import a number of other modules. Because I work on many systems, however, not all modules may be able to load on any particular machine. To make things slig...

How to translate RPC_STATUS into HRESULT?

In my COM component I need to translate all errors into the most suitable HRESULT values possible. Currently if I call some RPC interface method (I call a MIDL-generated stub that in turn calls NdrClientCall2()) and the call fails I return E_FAIL which is not very convenient. There's so-called facility in HRESULT. Can I use this? I tri...

web.config custom 404 error not working in IIS5

Hi, I've made a custom 404 error page in my codebase and have the following lines in the web.config to direct the customer to this page in the event of a 404. <httpErrors errorMode="Custom"> <remove statusCode="404" subStatusCode="-1"/> <error statusCode="404" prefixLanguageFilePath="" path="pgeNotFound.html" responseMode="File"/> ...

Form error event not firing on DAO error

I have a save button on a form that does this (simplified): If Not Me.Dirty Then GoTo Exit_ DoCmd.RunCommand acCmdSaveRecord Exit_: Exit Sub Err_: ' ... handle runtime error ... Resume Exit_ This form has its Error event handled in a custom class FormDataError. Private WithEvents frm_ As Access.Form ... Public Sub frm...

Handle error for duplicate entries - PHP MySQL

I have a PHP form which enters data into my MySQL database. My primary key is one of the user-entered values. When the user enters a value that already exists in the table, the MySQL error "Duplicate entry 'entered value' for key 1" is returned. Instead of that error, I would like to alert the user that they need to enter a different val...

What are the most common causes of errors in javascript and how to fix them?

Possible Duplicate: Common programming mistakes for JavaScript developers to avoid? This is kind of a subjective question, but I am hoping the well-tenured programmers might know of solutions. I have noticed now predominately in javascript, or any .js file that causes an error can halt further js from running. This could be a...

max execution time error handling

Hi! I have one script that sometimes gives Max execution times reached error. This is normal, not this a problem. The problem is that in this case I would write specific error message. How do i do this? ...

Close and dispose of resources before displaying error messages?

Is it good practice to close and dispose of resources before displaying error messages? If you are catching errors and you display an error message in the same scope as resources such as database and file objects, then shouldn't these resources be closed and disposed of before the error message is displayed? If you are waiting for th...

Begin Rescue not catching error

I'm using some ruby code wrapped in a begin - rescue block but somehow it manages to still crash. the block of code looks like this: # Retrieve messages from server def get_messages @connection.select('INBOX') @connection.uid_search(['ALL']).each do |uid| msg = @connection.uid_fetch(uid,'RFC822').first.attr['RFC822'] begin...