error-handling

Is there a SQL Server error numbers C# wrapper anyone knows of?

I really want to do something useful when a PK violation occurs but I hate trapping error numbers... they just don't read right without comments (they're certainly not self documenting). I know I can find all the potential error numbers at SQL Server books online but I really want to be able to pass the error number to some helper class...

[PHP] What exactly does it mean when $_FILES is empty?

I am working on a PHP upload script and when testing my error checks, I attempted to upload a 17MB TIFF file. When I do this the $_FILES array is empty. The script works fine for what I need it to do, which is to upload JPEG files. My solution is to test if $_FILES is empty or not before continuing with the upload script. Can anybody ex...

Passing data to notification page

I'm not sure what the best way of populating a notification page is. I've been using sessions to populate it with information, but this falls short if the user is blocking cookies. I've considered passing it in HTTP GET variables, but I'm unsure whether it's a good alternative since its length is limited by some browsers. Which method d...

How to further improve error messages in Scala parser-combinator based parsers?

I've coded a parser based on Scala parser combinators: class SxmlParser extends RegexParsers with ImplicitConversions with PackratParsers { [...] lazy val document: PackratParser[AstNodeDocument] = ((procinst | element | comment | cdata | whitespace | text)*) ^^ { AstNodeDocument(_) } [...] } obje...

In Objective-C, I'm trying to encapsulate multiple error-able calls and "return" the most useful error.

I put "return" in quotes because I don't want to literally return it. I want to do it similar to how you pass a pointer-to-a-pointer for [NSString stringWithContentsOfFile:usedEncoding:error:]. I would like to make parseFiles:error return nil and have the error reference that was passed in contain the first or second error, depending on...

Outputting all PHP errors to database not error_log

Is it possible to make all PHP errors be written to MySQL instead of to the standard error_log file. I guess this would be possible if i wrote my own error handler from scratch but i have a lot of legacy code in place and ideally i would just make 1 global change and that would be it. Can this be done? ...

PHP - white screen of death!

Hi everyone, After debugging a codeigniter app that were installed into a new development environment, I have started to freak out when seeing white screens with nothing more available. I have been able to solve each and every one of the errors that have caused this, but it have taken seriously way too long time. PHP error_reporting(E_...

Can I use foreign key restrictions to return meaningful UI errors with PHP

I want to start by saying that I am a big fan of using foreign keys and have a tendency to use them even on small projects to keep my database from being filled with orphaned data. On larger projects I end up with gobs of keys which end up covering upwards of 8 - 10 layers of data. I want to know if anyone could suggest a graceful way ...

Delphi: Application error logging in the field

Using Delphi 7, I wonder if there is a free component which will collect diagnostic information as my application runs at a remote site and will help me to debug error reports. Maybe it records each menu item selected, control clicked, text input, etc? Maybe it just dumps the stack on a crash. Maybe it does something else ... I don't m...

Error Handling in T-SQL Scalar Function

Ok.. this question could easily take multiple paths, so I will hit the more specific path first. While working with SQL Server 2005, I'm trying to create a scalar funtion that acts as a 'TryCast' from varchar to int. Where I encounter a problem is when I add a TRY block in the function; CREATE FUNCTION u_TryCastInt ( @Value as VARCH...

[PHP] Difference between exceptions and errors?

What is the difference between an error and an exception? I have read numerous resources online and in a couple of books, but the explanations provided are not very thorough. As such, I am still confused. Thanks! Edit: It looks like I asked two questions which was probably confusing. The main question that I wanted an answer to is th...

Error handling strategies for Microsoft HPC tasks

I have a .NET app that will be spawning tasks to run on an MS HPC cluster. We're not using any of that fancy DryadLINQ stuff, just remotely executing an exe on the cluster and passing arguments via the command line. The task will be .NET code, and I'd like the calling app to get an actual Exception object when an error occurs on HPC. Wh...

Asp.net error object not set to a reference

Hi all, Because I rush in development (a lot of whip cracking here) and declare my objects at the top of the function and instantiate inside my try-catch block, I get a lot of the good old "object not set to an instance of an object" errors while doing TDD, and later if I do miss a branch that object was used in (doing VB now, would pref...

MySQLi error handling

Is it possible to specify that MySQLi sends any errors and warnings to the PHP default 'error_log' directive? I can't seem to find any error options for the class specification, and I don't wish to handle errors manually like so: if ($result = $mysqli->query("...")) { } else handle $mysqli->error; ...

On null pointer arg, better to crash or throw exception?

Possible Duplicate: design by contract tests by assert or by exception? What is the preferred way to handle a null pointer passed in as an output argument to a function? I could ASSERT but I feel like its not good to let a library crash the program. Instead, I was thinking about using exceptions. ...

Why might a file only be partially uploaded?

Why might a file only be partially uploaded? I am improving error-handling in my PHP file upload script and am trying to figure out how to handle UPLOAD_ERR_PARTIAL properly. Should I prompt the user to try uploading the file again, or should I inform them that there is a more severe problem which is preventing them from uploading a p...

Error logging/handling on application basis?

Hi everybody, We have a web server that we're about to launch a number of applications on. On the server-level we have managed to work out the error handling with the help of Hyperic to notify the person who is in charge in the event of a database/memcached server is going down. However, we are still in the need of handling those event...

Avoiding try/catch hell in my web pages

I am writing an ASP.NET website, which is a new framework for me. I find that I have a try/catch block in literally every method of my codebehind. All these try/catch blocks do is catch the exception and then pop-up an error message to the user. Isn't there some sort of global error handler in ASP.NET? It's worth noting that my error han...

Zend Framework: How to handle exceptions in Ajax requests?

Normally when an exception is thrown, Error controller takes command and displays error page with regular common header and footer. This behavior is not wanted in Ajax request. Because in case of error, whole html page is sent over. And in cases where I'm directly loading the content of http response in a div, this is even more unwanted...

Quote about how many percentage of good code is error handling?

In one of the earliest podcasts I remember Jeff Attwood in the StackOverflow Podcast mentioning a quote about how x % (where x was something like 70 or more) of all good code was error handling. Does anyone know the exact quote? I can't seem to find it any more... ...