error-handling

Proper way in Python to raise errors while setting variables

What is the proper way to do error-checking in a class? Raising exceptions? Setting an instance variable dictionary "errors" that contains all the errors and returning it? Is it bad to print errors from a class? Do I have to return False if I'm raising an exception? Just want to make sure that I'm doing things right. Below is some...

Is it possible to programatically catch JavaScript SyntaxErrors?

I don't think that this is doable, but wanted to throw it out to the community to confirm my suspicions. Let's say you're writing a program in another language like Python, PHP, or ASP. This program is intended to build another program written in JavaScript. However, the first program is unfortunately not immune to errors. So, occ...

Error handling with Python + Pylons

What is the proper way to handle errors with Python + Pylons? Say a user sets a password via a form that, when passed to a model class via the controller, throws an error because it's too short. How should that error be handled so that an error message gets displayed on the web page rather than the entire script terminating to an error...

Is there a way to handle undefined functions being called in JavaScript?

If I have a function like the following: function catchUndefinedFunctionCall( name, arguments ) { alert( name + ' is not defined' ); } and I do something silly like foo( 'bar' ); when foo isn't defined, is there some way I can have my catch function called, with name being 'foo' and arguments being an array containing 'bar'? ...

unhandled errors in php

How can I know during runtime that my code threw a Warning? example try { echo (25/0); } catch (exception $exc) { echo "exception catched"; } throws a "Warning: Division by zero" error that i can not handle on my code. ...

When does the @ become usefull?

As you know, the @ characters before a php istruction suppress every eventual warning, error or notice from being raised. Personally, i dont like this tecnique, becose i prefer to handle those errors, and in a real life, the error must no happen or have to be managed. By the way, i find this tecnique to be applied in many scripts (cms ...

How can I catch for a connection timeout error in Python's SMTPlib?

The error being thrown is: error: [Errno 110] Connection timed out I'm not sure what to except for? try: smtpObj = smtplib.SMTP('smtp.example.com') smtpObj.starttls() smtpObj.login('user','pass') smtpObj.sendmail(sender, receivers, message) print "Successfully sent email" except smtplib...

Use of FTP "append" command

I want to upload a file to a ftp server programmatically (C++). If the connection is lost while uploading a file, I wouldn't want to upload the file from scratch, but to upload only the part that I haven't sent. Does the APPE command fulfill my demand? What list of FTP commands should I use exactly? And how? ...

icefaces error page not navigating to other pages

I'm working with Icefaces 1.8.2 and have created a custom error page. When I get to my error page (a jspx page built using facelets), I can't get out. It won't navigate away from the page no matter what link or action I select. I think I have everything setup properly but I'm new to icefaces so I have been doublechecking my setup like...

ASP.NET: disabling authentication for a single aspx page (custom error page)?

I am using a custom error page in IIS 6: <customErrors redirectMode="ResponseRedirect" mode="On" defaultRedirect="Error2.aspx"/> I want to disable authentication for the custom error page because the error being raised is related to an authentication module and I don't want to get into an infinite loop and I want to display a clean er...

Error handling with try catch (AGAIN)

Hi, just a general question, do you ALWAYS have to handle error? i was just having this debate with one of my coworker where in his code I see a lot places where stuff are wrapped around a try statement and in the catch statement there is nothing. I always thought it is a bad practice to not handling error or hide them from the user...

Centralized error handling in VB6.

I have the following method that all the error handlers call: Public Function ToError(strClass As String, strMethod As String) As String On Error GoTo errHandle ToError = "Err " & Err.Number & _ ", Src: " & Err.Source & _ ", Dsc: " & Err.Description & _ ", Proje...

Windows Workflow Foundation 4 (WF4) Error Handling

What is the best way to get error messages from a WF4 workflow back to a hosting ASP.NET MVC application? I need the workflow to not terminate, but continue to be active, and then pass a message back to the hosting app regarding the error, so the user can take an alternative action, but I'm not sure how to do that. ...

How can I log and retrieve error messages from a client-side desktop app?

Update: The service-based answers below are most likely the way to go, I am also curious to see if there are any out-the-box solutions anyone has tried in the field. Our system uses a client-server architecture, and with more clients using it I'm thinking of better ways to log client application errors, and get them sent to us. Curr...

What are best practices for error handling when writing an API for the iphone?

We are writing an API for iphone developers and we don't know what the best practice is for exception handling. We looked into NSError, standard POSIX way, NSException What is the convention that most APIs use? Which is the most "Objective-C friendly"? ...

Where did Pylons beautiful error handling go? Using Nginx + Paster + Flup#fcgi_thread

I need to run my development through nginx due to some complicated subdomain routing rules in my pylons app that wouldn't be handled otherwise. I had been using lighttpd + paster + Flup#scgi_thread and the nice error reporting by Pylons had been working fine in that environment. Yesterday I recompiled Python and MySQL for 64bit, and al...

skip-limit ignored for skippable exception thrown from writer

i am working on a project with spring batch 2.0.2 and have skippable exception set up in the config. for exceptions thrown from the processor everything works fine. it skips and once the limit is execeed the job fails (or stops). for exceptions thrown from the writer (same chunk) it keeps skipping. the skip-limit doesnt seem to matte...

Access Error when running windows program

I have a windows form application that uses microsoft access for the database on the backend. When I run that application I get an error that says access is not installed on the computer. I thought that if I included the reference that it will be included with what I release so the user would not have to have access installed. How...

Looking for an automated logging tool/library for .NET

I'm looking for an library/tool for .NET that logs almost everything that happens in my C# application (Windows Form). The problem is that I'm delivering an application to a client (Windows XP) and after doing some task, that classic Microsoft error window appears: "ApplicationName has encountered a problem and needs to close. We ...

Handling errors on php contact form

The below code is working great for handling errors for text fields in my contact form, but how do I get this same method to work for dropdown select option boxes and textareas? <input type="text" name="name" value="<?php if($errors){echo $name;} ?>" id="name" size="30" /> For example: <textarea name="message" value="<?php if($error...