Say that I've got a web application that can store Persons in a database. Every Person must have a unique email address (or username or whatever). If a user attempts to add a Person with an email address that already exists, the form should be returned with an error message (like it would during a typical validation failure).
How is t...
So:
@fopen($file);
Ignores any errors and continues
fopen($file) or die("Unable to retrieve file");
Ignores error, kills program and prints a custom message
Is there an easy way to ignore errors from a function, print a custom error message and not kill the program?
...
In struts2 version 2.1.x there is a new UnknownHandler that kicks in when a request arrives and the action name cannot be found.
The question is...what is the equivalent mechanism if one exists in 2.0.x versions?
I recently noticed from examining the log files that exceptions are thrown when the action name is not properly resolved a...
I have a file that opens a URL and reads it and does the parsing.
Now if that URL goes dwon and my file fails to open it then what i need is that an error mail should get generated but on terminal or konsole no error message should appear.
how can i do that?
Plz help!!
...
I am wondering how in practice other SOers tend to deal with and/or prevent exceptions.
In what situations do you prevent exceptions, and how?
In what situations do you catch exceptions?
I usually prevent 'NullPointerExceptions' (and other similar ones) by, well, essentially saying if(foo!=null) {...}
I find that in most situations t...
One thing I've always had trouble with in Cocoa Bindings has been error presentation, for example when the user types the wrong value into a text field with a formatter attached. Normally I would override willPresentError: somewhere in the responder chain, but my problem is the NSError objects created by the Bindings system doesn't conta...
I have a standalone (non-IIS) WCF service that - besides the services - provides some simple HTML pages via a WebServiceHost.
When I enter http://localhost:1234/SomeRandomWords as an URL into the browser I get a default error page that says
Dienst
Es wurde kein Endpunkt gefunden
(Translated to english: Service / Endpoint not found)
...
Hi,
I do an import and convert columns to other datatypes. During the import I check, if I can convert the values stored in the columns into the target datatypes. If not I put a default value, e.g. I convert a string to int and when I cannot convert the string I insert -1.
At this moment it would be great if I could log the erroneous e...
Recently i worked in project. there i need to a rename a picture. the problem is when i rename the picture it renamed but show a warning message like bellow
Warning: rename(seeker/SeekerPhoto/katr.jpg,seeker/SeekerPhoto/ussl.jpg) [function.rename]: No such file or directory in /subdomains/www/html/ussl/job/insphoto.php on line 100
ho...
if you are careful and use TRY-CATCH around everything, and rollback on errors do you really need to use:
SET XACT_ABORT ON
In other words, is there any error that TRY-CATCH will miss that SET XACT_ABORT ON will handle?
...
Update:
I tried to run this on a local instance of sql-server and sadly it worked!!!
now I know that the code is right and there is some kind of DBA restriction I need to find (and ask the DBA to remove)
Any ideas?
using System;
using System.Collections.Generic;
using System.Text;
using System.Data.SqlClient;
using System.Data;
na...
Is this code:
System.Diagnostics.StackFrame stackFrame = new System.Diagnostics.StackFrame();
System.Reflection.MethodBase methodBase = stackFrame.GetMethod();
stackFrame.GetFileName();
stackFrame.GetFileLineNumber();
better for debugging compared to using a System.Diagnostics.StackTrace
...
We work on desktop applications with WPF. We'd like to have a top-level exception handler that displays an error message and sends it back to our application servers. Our users are non-technical end-users who would not be interested in stack traces or complicated exception messages.
What would you put inside the error message that th...
How can I make xmlpp::DomParser be less verbose on errors? Right now, if parsing fails, I get a bunch of text printed to my console and I'd just as soon have that not be visible.
Entity: line 1: parser error : Opening and ending tag mismatch:
feed line 1 and fed
<feed><entry id='5' /></fed>
I don't see a lot of options for xmlpp::DomP...
Hi,
I've been wondering why would I use Exceptions in my PHP. Let's take a look at a simple example:
class Worker
{
public function goToWork()
{
return $isInThatMood ?
// Okay, I'll do it.
true :
// In your dreams...
false;
}
}
$worker = new Worker;
if (!$worker->goToWork())
{
if (date('l',time()) == 'Sunday')
echo "F...
I have a function that checks whether a type is a subtype of another type:
st :: Monad m => Map String Type -- ^type environment
-> Set (Type, Type) -- ^assumed subtypes
-> (Type, Type) -- ^we are checking if lhs <: rhs
-> m (Set (Type, Type))
I want to do error handling. I have the following definition:
instance Mona...
(Oracle PL/SQL)
If I have a simple SQL statement that is throwing an error, ie:
DECLARE
v_sql_errm varchar2(2048);
BEGIN
UPDATE my_table SET my_column = do_something(my_column)
WHERE my_column IS NOT NULL;
EXCEPTION
when others then
-- How can I obtain the row/value causing the error (unknown)?
v_sql...
Hi, I have been thinking about the difficulty incurred with C error handling.. like who actually does
if(printf("hello world")==-1){exit(1);}
But you break common standards by not doing such verbose, and usually useless coding. Well what if you had a wrapper around the libc? like so you could do something like..
//main...
error_catch...
I've got a bunch of XHR actions in a controller, which return some HTML to insert into the page. If the response is an error, then it puts the output into a special error div. So far, nothing particularly interesting.
However, this general process doesn't work for Rails' exception handling. If I raise an exception in my XHR actions, ...
We are three internal developers with a user count of about twenty. We've implemented unhandled exception handling in our Winforms app. It generates a ticket with the stack trace in our FogBugz (renamed internally to DevTracker) bug tracking system.
The goal is to encourage the user to enter an informative bug rather than simply movin...