I'm kind of torn between these two error-handling models:
Create a boolean Error and a string ErrorMessage property for your object. Catch all exceptions internally in the object's methods and pass the messages along using conditional logic from the caller, ie:
Dim o As New MyObject
o.SomeMethod()
If Not o.Error Then
'Do stuff'
El...
I have a custom error handler attached to E_ALL PHP errors.
In an external lib the call $row = @mysql_fetch_assoc($this->result); triggers PHP Warnings caught by my handler. Why? Shouldn't '@' make PHP ignore this?
My question: Is there any way I can detect (in my error handler) that '@' was used?
...
We are building an ASP.NET application in C#
We have 3 layers: UI, Business and Database. We need clarification on error handling/logging. We have a error logging framework to log errors.
My question is: do we need to log errors in each layer or only in the main calling layer (UI layer) by throwing the errors to UI layer from busines...
I have a controller that needs to return a 404 page and status code on certain conditions. I can't seem to find out how to do this in Grails. A coworker recommended this method:
response.sendError(HttpServletResponse.SC_NOT_FOUND)
which works perfectly fine, but it's not very Grails-like. I know Rails' render method take a status argu...
I'm writing code that runs all sorts of external commands as well as various filesystem commands that can fail.
Is there any module that can save me the trouble of adding or die to anything that can fail?
I'd like to be able to wrap the following in something so that instead of:
mkdir $dirname or die "can't create directory $dirname"...
How would you implement different types of errors, so you'd be able to catch specific ones and let others bubble up..?
One way to achieve this is to modify the prototype of the Error object:
Error.prototype.sender = "";
function throwSpecificError()
{
var e = new Error();
e.sender = "specific";
throw e;
}
Catch specif...
Given that I have a custom PHP error handler already, does it make sense to define an exception handler as an "forwarder" like this:
function exception_handler(Exception $e) {
trigger_error($e->getMessage(), E_USER_ERROR);
}
set_exception_handler('exception_handler');
The idea is to utilize the already existing error handler to ha...
Background:
Suppose I have a powershell function that understands and interprets small_commands such as:
todolist.additem/title=shopping/body=get milk
Suppose further that I invoke the function like this:
myfunc [small_command goes here]
Question:
Is there a way that I can type in the small_command and still have powershell invoke...
I have an HttpModule that I have put together from cobbling a couple of different sources online together into something that (mostly) works with both traditional ASP.NET applications, as well as ASP.NET MVC applications. The largest part of this comes from the kigg project on CodePlex. My problem is in dealing with 404 errors due to a...
I am using asp.net and I am always struggling for a neat way to handle errors and if there are any, to pass the errormessage to the user. For example, I have an User class, UserManager class and a Database class. Imagina I want to show all the users, show I call the method GetAllUsers from UserManagerwhich returns a list of User objects....
The @EJB annotation can be use in "managed clients" to access an EJB.
One can place this annotation in a servlet class, declaring a member variable.
public class MyServlet extends HttpServlet {
@EJB
private MyWorkerInterface theWorker;
}
That @EJB annotation is expanded to JNDI lookups that (I assume) are executed when th...
I was wondering what the excepted standard is for handling errors in the Model.
Currently I have 'setError' and 'getError' methods that's in use by all my Models.
This means I'm only concerned with whether a call to a method in my Model is true or false. If it's false then I would use $this->model->getError() in my Controller.
Additio...
Hello there,
Don't know if this particular forum is the best place to ask this question...
What is the best way to handle error response codes generated from Facebook REST API calls using server side Java?
For example, if in a deployed app, a person calls Friends.get:
http://wiki.developers.facebook.com/index.php/Friends.get
The fo...
I want to make a general error handling package that should be called from my other packages when something goes wrong. In this error handling package I want to log what task failed and the reason for the failure. How can I retrieve this information?
I'm using the Control Flow Failure precedence constraint to point out a Execute Package...
I seen this in legacy code. What, if any, is the purpose of a single Throw within a Catch?
Try
'Some Oracle access statement
Catch err As OracleClient.OracleException
Throw
Finally
'Do something
End Try
Is the outcome the same as if the original error was not caught? Would ...
.
Hi,
Good morning.
Would you please let me know whether we need to write exception handling mechanism (Try, Catch blocks) in database stored procedures? Is it the best Practice? (As the corresponding error will be thrown to the calling ASP.NET application itself whenever an error occurs in the database stored procedure.)
Thanks and...
Hey
I want to use Application_Error with my MVC project, but i can't get it to work. I add the following to my Global.asax file:
protected void Application_Error(object sender, EventArgs e)
{
Exception objErr = Server.GetLastError().GetBaseException();
Session["Test"] = "Message:" + objErr.Message.ToString();
...
What is the best practice when dealing with Errors within a server application?
In particular, how do you think an application should handle errors like OutOfMemoryError?
I'm particularly interested in Java applications running within Tomcat, but I think that is a more general problem.
The reason I'm asking is because I am reviewing...
Now that I'm starting to get back into PHP, I'm starting to remember why I gave it up in the first place. The most annoying thing on my plate at the moment is what I've come to term "PHP's white screen of death". When PHP gets a fatal error due to syntax or whatever, it seems like it will always die without actually sending anything to t...
In many cases in web applications you would need to return an error message, rather than simple true/false result. One would use exceptions for that, but I consider exceptions to be an indication of, you know, exceptional behavior. Let's take a Register() function for a class User for instance. If it was successful we can simply return t...