I'm a Java beginner so please bear with me :P
static int load = 100;
static int greet;
public void loadDeduct(int cLoad, int c){
int balance;
balance = cLoad - 7;
System.out.println("Your balance: " + balance);
}
public void loadDeduct(int tLoad){
int balance;
balance = tLoad - 1;
System.out.println("Your balan...
It is possible to catch an exception and throw a new exception which wraps the first exception as an inner exception:
http://msdn.microsoft.com/en-us/library/system.exception.innerexception(VS.71).aspx
Also, if I call a function and it throws a certain error, but I catch it, will the calling code's catch handler execute? If so, and it ...
Maybe I'm missing it somewhere in the PHP manual, but what exactly is the difference between an error and an exception? The only difference that I can see is that errors and exceptions are handled differently. But what causes an exception and what causes an error?
...
I am curious as to how people trap certain database errors in .NET, particulary foreign key or unique index violations. Coming from a Classic ASP/VB background, my first inclination is to test the error number to then create a friendly message to the user that something is wrong. However, I would think that in the .NET world, there wou...
I'm developing a C api for some functionality written in C++ and I want to make sure that no exceptions are propagated out of any of the exported C functions.
The simple way to do it is making sure each exported function is contained in a:
try {
// Do the actual code
} catch (...) {
return ERROR_UNHANDLED_EXCEPTION;
}
Let's say...
I am currently using a C# .NET Service in our client program. As part of the server design, several custom made exceptions are thrown to indicate specific errors (as in any normal desktop program).
The problem is that the Web Service catches these errors and serializes them into a FaultException, with the actual exception (like NoRoomsA...
Why String.indexOf do not use exception but return -1 when substring not found?
The purpose of this question is: when we start custom exception.
I believe avoid the need to return special error code is right design path.
What's your opinion?
...
I'm familiar with the AspectJ syntax for intercepting Exceptions using the "handler" designator, but I'm trying to get the same item working with JBossAOP.
Would anyone know how to catch all exception throws so I can log them using JBossAOP?
Thanks!
...
I have an application utilizing lots of AJAX requests (different actions are triggered via XHR requests). Some of those calls may result in exceptions. Each time I have to display an error message to the user. How can I organize error handling in this case?
...
Hi,
Folks, forgive me, I'm pretty much a raw prawn when it comes to C#, and .NET generally... though I've been a professional programmer for 10 years.
I'm looking at this article: http://www.codeproject.com/KB/cs/datatransferobject.aspx on Serializable DTO's.
The article includes this piece of code:
public static string SerializeDTO(...
In Brian Goetz's article on how to handle InterruptedException, one paragraph stands out:
The one time it's acceptable to swallow an interrupt is when you know the thread is about to exit. This scenario only occurs when the class calling the interruptible method is part of a Thread, not a Runnable.
I don't get this. Is the reason ...
When an exception is thrown or encountered:
void ThrowException()
{
try
{
throw new Exception("Error");
}
catch
{
}
}
is it & how is it disposed from memory?
and how does the above code differ from the below code in respect of the disposal from memory of the Exception object?
void ThrowException()
{
...
If we are to catch specific forms of IOException, or any other kind as a
matter of fact, and we only try and catch a couple (and define definitive outputs for them) say
FileNotFoundException
ZipException
should we always trail it off and cover all bases with a
catch(IOException e){
e.printStackTrace();
}
and then possibly go ev...
I am using Enterprise Library 4.x for my exception handling logging (ASP.NET application).
Here is the EntLib method I am calling:
ExceptionPolicy.HandleException(ex, exceptionPolicy.ToString());
How can I add a bit more details to the exception, like current request url, current user name, etc.?
I know I could wrap it in my except...
if hasattr(obj, 'attribute'):
# do somthing
vs
try:
# access obj.attribute
except AttributeError, e:
# deal with AttributeError
Which should be preferred and why?
...
I'd like all of my .Net applications to be able to log unhandled exceptions via the internet when a connection is available. Are there any libraries people use for this purpose (preferably free/open source)?
...
I've used exceptions in Java and like the way it won't let you call a method unless you catch or throw the exceptions that it might throw.
I'm looking for something similar in PHP. I realise PHP is more dynamic than Java, and doesn't even let you define the exceptions that it throws, but what is the closest I can get?
We document our m...
Why is UnhandledExceptionEventArgs.ExceptionObject an object and not an Exception?
I am attaching to AppDomain.UnhandledException.
I would like to cast UnhandledExceptionEventArgs.ExceptionObject to an Exeption and interogate it.
And with this in mind will it ever be null?
The MSDN documentation is not exatly useful
http://msdn.mic...
What is the best way to confirm that these consumed services are actually up and running before I actually try to invoke its operation contracts? I want to do this so that I can gracefully display some message to the customer to give him/her a more pleasant user experience. Thanks.
...
I have a project consisting of a windows client (approx. 150 users), a webservice and some windows services. All together working in an intranet and build using C# .NET 3.5. Now I want to log exceptions in a central database and manage them (watch top 10, ticket system, etc.) via a web application.
I thought about using and expanding EL...