error-handling

Graceful DOS Command Error-Handling

PHP 5.2.13 on Windows 2003 I am using the DOS Start /B command to launch a background application using the PHP popen() function: popen("start /B {$_SERVER['HOMEPATH']}/{$app}.exe > {$_SERVER['HOMEPATH']}/bg_output.log 2>&1 & echo $!", 'r'); The popen() function launches a cmd.exe process that runs the specified command; however, if...

Websphere exception handling

Hi all, From a security standpoint, what is the best solution to handle application errors with Websphere? I've been thinking of creating a class that is called every time an application error is generated, log the error and display a generic error message to the users. In PHP this can be achieved using the set_exception_handler() fun...

"Unable to open file", when the program tries to open file in /proc

Hi, I try to read file /proc/'pid'/status, using c program. The code is as follows, and even I use sudo to run it, the prompt still keeps throwing "Unable to open file". Please let me know if you have any ideas on how to fix this. thanks Richard ... int main (int argc, char* argv[]) { string line; char* fileLoc; if(ar...

JavaScript try/catch: errors or exceptions?

OK. I may be splitting hairs here, but my code isn't consistent and I'd like to make it so. But before I do, I want to make sure I'm going the right way. In practice this doesn't matter, but this has been bothering me for a while so I figured I'd ask my peers... Every time I use a try... catch statement, in the catch block I always log ...

R: How to tell lapply to ignore an error and process the next thing in the list?

I have an example function below that reads in a date as a string and returns it as a date object. If it reads a string that it cannot convert to a date, it returns an error. testFunction <- function (date_in) { return(as.Date(date_in)) } testFunction("2010-04-06") # this works fine testFunction("foo") # this returns an erro...

Proper mechanism for sending PHP errors to the client

Greetings, I was trying to discover a proper way to send captured errors or business logic exceptions to the client in an Ajax-PHP system. In my case, the browser needs to react differently depending on whether a request was successful or not. However in all the examples I've found, only a simple string is reported back to the browser in...

isset($var) vs. @$var

Is this an okay practice or an acceptable way to use PHP's error suppressing? if (isset($_REQUEST['id']) && $_REQUEST['id'] == 6) { echo 'hi'; } if (@$_REQUEST['id'] == 6) { echo 'hi'; } EDIT: I thought so too. The code (and idea) is from friend. Thanks for proving me right. :) ...

Programming Concepts: What should be done when an exception is thrown?

This does not really apply to any language specifically, but if it matters I am using VB.NET in Visual Studio 2008. I can't seem to find anything really that useful using Google about this topic, but I was wondering what is common practice when an exception is thrown and caught but since it has been thrown the application cannot continu...

javascript: how to display script errors in a popup alert?

I want to display script errors in a popup alert instead of showing them in the browser console. window.onerror = function() { var message = /* get error messages and put them here */; alert(message); return true; }; ...

WPF Application doesn't work on some machines: Stopped working error

My WPF application works fine on a number of machines, but now I get a report about this error on a user machine: Description: Stopped working Problem signature: Problem Event Name: CLR20r3 Problem Signature 01: mysoftware.exe Problem Signature 02: 1.0.0.1 Problem Signature 03: 4bbcd9d9 Problem Signature 04: ...

PHP execution timing out after update

Needed Finfo but deleted msi package, so uninstalled php 5.3.0, downloaded 5.3.2 and installed. Now all my sites have max execution time error's when they hit my custom error handlers. No problems until I updated - has anyone ran into this before? Checked all error logs and ran through config files - nothing stands out. Edit: Commente...

Automatically reporting javascript errors to the developer

As most production environments we have setup something to send us a notification if there is an error in our web application. The problem is ofcourse that this only covers errors on the server side. My question to the community is: What are you doing about client side errors, especially in javascript? And what about other quality of s...

Show alert message box from the Global.asax (on Application_Error event)

Normally I just redirect to a custom error page in on the Application_Error event, but I have a specific error for which I'd like to display an alert message while the user is still on the page which triggers the error. How can I make this happen? I'm open to a modalpopup or any other type of error message, I just want to ensure the us...

Java: dangerous self-returning-recursive function by IOException?

I had very errorsome Exception handling with if-clauses. An exception occurs if not found path. An exception returns the function again. The function is recursive. Safe? $ javac SubDirs.java $ java SubDirs Give me an path. . Dir1 Dir2 Give me an path. IT WON'T FIND ME, SO IT RETURNS ITSELF due to Exception caught Give me an path. Th...

Perl: catch error without die

I'm playing around with error handling and got a little problem. I connect with a database using the DBI module. I do my own error handling by using a subroutine that I call upon an error. I can catch my own dies and handle them just fine but when my database connection fails, the DBI module apparently prints out it's own die : DBI co...

Java: custom-exception-error

$ javac TestExceptions.java TestExceptions.java:11: cannot find symbol symbol : class test location: class TestExceptions throw new TestExceptions.test("If you see me, exceptions work!"); ^ 1 error Code import java.util.*; import java.io.*; public class TestExceptions { static voi...

Java: how to access assignments in try-catch -loop?

The problem drives me to the big try-catch loops. I want smaller. So how to access assignments in the loops? $ javac TestInit2.java TestInit2.java:13: variable unknown might not have been initialized System.out.println(unknown); ^ 1 error Code import java.util.*; import java.io.*; public class TestInit2 { p...

Java: exception-throwing class?

I have classes DirReader and Search. The search uses DirReader. I want the search to know when DirReader throws exception. So how can I have class throwing exception? Currently, I use initCorrect -dummy var. Exception-style method may be more appropriate. Simplified Example Error $ javac ExceptionStatic.java ExceptionStatic.java:4: '...

MVC 2 Catch-All for connection string missing or connect failure

In the event my project is deployed with an incorrect, incomplete or missing connection string i'd like an application startup check for db connectivity, and if there is none, direct all requests to a DatabaseConnectionError page of some sort, what are my options? I don't think there's a specific http error code that would fit this error...

Tomcat Exception-Type Ignoring Specific Exception for More General

For one type of exception, IOException, I want to display one page. For all other exceptions I have a default error page. In my web.xml I have things setup like this: <error-page> <exception-type>java.io.IOException</exception-type> <location>/queryException.jsp</location> </error-page> <error-page> <exception-type>java.lang.E...