error-handling

ror: How to catch error from google smtp server?

I am very new to ruby on rails. in my ror application there is a form. where the user can enter a gmail address and password and send email to other user using gmail smtp server.It is working well. But, the problem is if the user enters the wrong password my application is not showing any error... and the mail is not sent. My question ...

Error handling for xml parsing

I'm using tinyxml to parse xml files, and I've found that error handling here lends itself to arrow code. Our error handling is simply reporting a message to a file. Here is an example: const TiXmlElement *objectType = dataRoot->FirstChildElement( "game_object" ); if ( objectType ) { do { const char *path = objectType->At...

What are "cerr" and "stderr"? *warning, major newbie question*

What is the difference between them and how are they used? Can anyone point me to examples? Specifically how do you "write" to the stream in both cases and how do you recover and output (ie to the screen) the text that had been written to it? Also, the "screen" output is itself a stream right? Maybe I don't understand streams well enou...

Displaying error message in popup JSF

How to generate popup while displaying validation error? For example for <h:inputText required="true"> if I skip and press submit button I want to display <h:message> in a popup. Is that possible in JSF 2.0 or using jQuery or any other? ...

How to do error logging in php codeigniter?

Hi I am trying to do error logging in php codeigniter, I want to to know some bascis of error logging, 1. what are all the steps to be fallowed to log an error, 2. How an error logging file is created, 3. How to push the error message into log file( Incase, any error occurs) 4. How to do e-mail that error to the destina...

Can't handle errors in PHP's SoapServer->handle() method

I've created a WSDL-based SOAP web service using PHP 5.3. I'm using Zend Framework to handle the service, and ZF in turn is layered atop PHP's built-in SoapServer class. In testing with SoapUI, I discovered that passing a parameter of invalid type (e.g., passing a string when an integer is defined by the WSDL) resulted an empty response...

How to keep code layout visually 'attractive' when introducing error handling ?

When writing code, I find it important that my code looks well (apart from the fact that it has to work well). It is well described in the book Code Complete (p729): 'The visual and intellectual enjoyment of well-formatted code is a pleasure that few nonprogrammers can appreciate'. The problem is, as soon as I got my code functionally w...

Error handling in the model, or in the controller?

Hi! I asked around on various IRC channels but was unable to get an answer with a definitive explanation behind it. Should errors (pertaining to the model, such as transaction failures) be handled in the model, or in the controller? Thanks in advance for any help. EDIT Well, the confusing thing is that my code (in the model) looks so...

ASP.NET MVC how can I return an error from a file download action without leaving the current page?

I am calling a file download action from javascript: $elem.click(function() { window.location.href = 'MyController/MyFileDownloadAction'; }); The controller returns a file: [AcceptVerbs(HttpVerbs.Post)] public ActionResult MyFileDownloadAction() { /* do some processing, generate an in-memory file... */ return File(myFil...

What is GHCi's default implementation of MonadError?

Consider the following test function: testError :: (Error e, MonadError e m) => Bool -> m () testError True = return () testError False = throwError $ strMsg "hello world" At the GHCi prompt, I can do the following: *Main> testError False :: Either String () Left "hello world" *Main> testError True :: Either String () Right () Bec...

obtaining error number of an error

I need to obtain the error number from an error that has occurred in Python. Ex; When trying to transfer a directory via the Paramiko package, an error is caught with this piece of code: try: sftp.put(local_path,target_path) except (IOError,OSError),errno: print "Error:",errno For which I get the outpu...

using the db to prevent errors in a UI presentation

I am going though this msdn article by noted DDD expert Udi Dahan, where he makes a great observation that he said took him years to realize; "Bringing all e-mail addresses into memory would probably get you locked up by the performance police. Even having the domain model call some service, which calls the database, to see if the e-mail...

Wicket: Where to handle JDBC connection error

Hi, I have a Spring based Wicket app. There's a pooled datasource bean. Now, when MySQL is dead, I get a default Wicket error page with a stacktrace. I'd like to handle this situation and to only allow some pages to fully display (the static ones), and to show a custom error page for the others. How should I efficiently implement thi...

Accessing Session in MasterPage load event after a UrlRewrite

Situation: In Web.Config we have CustomErrors turned on with redirectMode="ResponseRewrite". In Page_Load of our MasterPage we access the Session property of the Page. Problem: When an Error occurs on any page the user gets redirected (via Rewrite) to our Error.aspx Page. There in the Page_Load of the MasterPage we access the Sessio...

Simple robust error correction for transmission of ascii over serial (RS485)

I have a very low speed data connection over serial (RS485): 9600 baud actual data transmission rate is about 25% of that. The serial line is going through an area of extremely high EMR. Peak fluctuations can reach 3000 KV. I am not in the position (yet) to force a change in the physical medium, but could easily offer to put in a simpl...

Good Sample .Net Windows service to report an error

Hi all, I am writing a windows service that will be doing a lot of network communication (copy many many files in shared folders and modify database). I need a way to notify a user (if logged on) of any exceptions/errors. My issue is do group to errors for send it (by email) to administrator address. I am aware of event logging neithe...

Displaying caught errors outside of IDE - overkill/critique?

I have devised the following method for catching errors throughout my AS3 applications: In the Document class, define the following methods: //This is the handler for listening for errors protected function catchError(event:ErrorEvent):void { displayError('Error caught: ' + event.text); } //Creates a MovieClip with a TextField as ...

How to handle a float overflow?

If a float overflow occurs on a value, I want to set it to zero, like this... m_speed += val; if ( m_speed > numeric_limits<float>::max()) { // This might not even work, since some impls will wraparound after previous line m_speed = 0.f } but once val has been added to m_speed, the overflow has already occurred (and I'm assuming tha...

Displaying Grails Field Errors

Does anybody know how I could get the fieldError to print out in the example below. for each item with an error, I would like to print custom error messages that I have defined in the messages.properties file at the moment all this does is print the default error codes item.errors?.allErrors?.each{ println it.toString() }; I have ...

How can I keep AJAX from complaining when the window closes?

I have this... well okay not really this but this is the important stuff: window.onbeforeunload = function() { return 'you sure?'; } ... and I have this inside my $.ajax() calls: error: function(xhr, textStatus, errorThrown) { if (textStatus == 'timeout') { HandleError('Connection error.'); return; } ...