I keep seeing people say that exceptions are slow but I never see any proof. So instead of asking if they are I will ask how do exceptions work behind the scene so I can make a decisions of when to use them and if they are slow.
From what I know exceptions are the same thing as doing a bunch of return but it also checks when it needs to...
I'm writing an error handling module for a fairly complex system architected into layers. Sometimes our data layer throws obscure exceptions.
It would be really handy to log out the values of the parameters of the method that threw the exception.
I can reflect on the TargetSite property of the exception to find the method's parameter ...
In Java, what is the difference between the twin methods?
public void methodA() throws AnException {
//do something
throw new AnException();
}
public void methodA() {
//do the same thing
throw new AnException();
}
I have a intuition that it has something to do with being a well-designed method (because I put methodA i...
Help with using the xapian php wrapper.
I have a couple of custom exception handlers for different categories of errors (I'm thinking of seperating them out more).
Xapian handles errors by throwing standard Exception objects.
I would like to use a custom exception handler for these though. How do I go about using a custom exception for...
WARNING: I have been learning Python for all of 10 minutes so apologies for any stupid questions!
I have written the following code, however I get the following exception:
Message File
Name Line Position Traceback Node
31
exceptions.TypeError: this constructor takes no arguments
class Computer:
n...
Hi,
while writing a custom attribute in C# i was wondering if there are any guidelines or best practices regarding exceptions in attributes.
Should the attribute check the given parameters for validity? Or is this the task of the user of the property?
In a simple test I did the exception was not thrown until i used GetCustomAttributes ...
Is it possible to have a post-mortem ( or post-exception ) debugging session in Java ? What would the workarounds be ( if there isn't a solution for this already ) ?
...
Is there a c++ equivalent of java's
try {
...
}
catch (Throwable t) {
...
}
I am trying to debug java/jni code that calls native windows functions and the virtual machine keeps crashing. The native code appears fine in unit testing and only seems to crash when called through jni. A generic exception catching mechanism would ...
GCC supports Setjump-longjump (sjlj) and Dwarf2 table-based unwinding (dw2) exception handling models. What is the difference between the two models and how to choose the appropriate model? Why is Dwarf2 table-based unwinding (dw2) the more efficient model? I understand that the two models cannot be mixed.
Reference: Technology Preview:...
all files in ~/Cipher/nsdl/crypto can be found here
java files compiled with gcj, see compile.sh
nmint@nqmk-mint ~/Cipher/nsdl/crypto $ echo test | ./cryptTest encrypt deadbeefdeadbeefdeadbeefdeadbeef deadbeef Blowfish CBC > test
null
Exception in thread "main" java.lang.IllegalStateException: cipher is not for encrypting or decrypting
...
I used standard exception handling methods in C++. Which is try{} and catch{} block. In my code, func1() would throw an exception, And func2 is like this:
bool func2()
{
try{
func1();
}
catch(myException& e)
{
cerr << "error!" << endl;
return false;
}
return true;
}
But when I run my code,...
Edit: Closing this because i've found the reason why it's erroring, but instead of removing this post .. i generate a newer post with a more refined question.
Hi folks,
i have some binary data i've read in. i wish to convert it to an System.Drawing.Image, so i create an instance of an Image object, using a memory stream as the input ...
How do you get the name and/or description of an SEH exception without having to hard-code the strings into your application?
I tried to use FormatMessage(), but it truncates the message sometimes, even if you specify to ignore inserts:
__asm { // raise access violation
xor eax, eax
mov eax, [eax]
}
Raises an exception ...
I have a WCF service with the following configuration:
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="MetadataEnabled">
<serviceDebug includeExceptionDetailInFaults="true" />
<serviceMetadata httpGetEnabled="true" />
</behavior>
</serviceBe...
What are the tensions between multithreading and exception-safety in C++? Are there good guidelines to follow? Does a thread terminate because of an uncaught exception?
...
A good friend of mine works for a large asp.net shop, with a web farm with many web servers (dozens). The application logs exceptions and messages to the event log on each box (not to a centralized location).
Does anyone know of a convenient way to perform unified reporting on event logs on a number of different boxes?
Or, which is be...
I'm using .NET 3.5, trying to recursively delete a directory using:
Directory.Delete(myPath, true);
My understanding is that this should throw if files are in use or there is a permissions problem, but otherwise it should delete the directory and all of its contents.
However, I occasionally get this:
System.IO.IOException: The direc...
Assume that write operation throws an exception hafl-way, is there any data written into the file, or there is no data written in the file?
Thank you!
...
I've been programming a long time, and the programs I see, when they run out of memory, attempt to clean up and exit, i.e. fail gracefully. I can't remember the last time I saw one actually attempt to recover and continue operating normally.
So much processing relies on being able to successfully allocate memory, especially in garbage c...
Is there a C# equivalent method to Java's Exception.printStackTrace() or do I have to write something myself, working my way through the InnerExceptions?
...