I'm calling a stored procedure on a SQL Server 2005 database which returns an XML resultset. Sometimes it will return an null resultset becuase there are not rows to return. When this happens athe ExecuteXmlReader method throws a TargetInvocationException. This seems to be a known issue (see: http://social.msdn.microsoft.com/Forums/en-US...
i am reading this page http://www.cplusplus.com/doc/tutorial/exceptions.html
it says if i write function() throw(); no exceptions can be thrown in that function. I tried in msvc 2005 writing throw(), throw(int), throw() and nothing at all. each had the exact same results. Nothing. I threw int, char*, another type and it was all caught th...
I want to write some code to handle exceptions when HTTP connection fails. I use the following codes:
-(void) connection:(NSURLConnection *)connection
didFailWithError: (NSError *)error {
UIAlertView *errorAlert = [[UIAlertView alloc]
initWithTitle: [error localizedDescription]
message: [error localizedFailureReaso...
Error Cannot implicitly convert type 'string[]' to 'System.Collections.Generic.List<string>'
The above error is caused when I call a method to a web service
List<string> bob = myService.GetAllList();
Where: GetAllList =
[WebMethod]
public List<string> GetAllList()
{
List<string> list ....
r...
I try to add a method to handle exception, but the program just crashes instead of pop up an AlertView.
1) I set up the connection:
-(void)connect:(NSString *)strURL
{
NSURLRequest *theRequest=[NSURLRequest requestWithURL:[NSURL URLWithString:strURL]
cachePolicy:NSURLRequestUseProtocolCachePolicy
...
I haven't been able to replicate the exception when I browse my site... but I found out about this through my event logger (it emails my cell phone when an unhandled exception occurs).
Here's the exception:
The controller for path
'/Content/UsrImg/ImageFileName.jpg'
could not be found or it does not
implement IController.
Wh...
I am using a dictionary to perform lookups for a program I am working on. I run a bunch of keys through the dictionary, and I expect some keys to not have a value. I catch the KeyNotFoundException right where it occurs, and absorb it. All other exceptions will propagate to the top. Is this the best way to handle this? Or should I us...
I currently have a technical point of difference with an acquaintance. In a nutshell, it's the difference between these two basic styles of Java exception handling:
Option 1 (mine):
try {
...
} catch (OneKindOfException) {
...
} catch (AnotherKind) {
...
} catch (AThirdKind) {
...
}
Option 2 (his):
try {
...
} catch (AppException e)...
I am writing some JUnit tests that verify that an exception of type MyCustomException is thrown. However, this exception is wrapped in other exceptions a number of times, e.g. in an InvocationTargetException, which in turn is wrapped in a RuntimeException.
What's the best way to determine whether MyCustomException somehow caused the exc...
I have two Microsoft SQL 2005 databases setup in a fail over scenario. The application connection strings have the "Failover Partner" specified in the connection string.
When the currently live database fails over to the slave database, there is a small time period that a user can obtain a SqlClient.SqlException with the message "An ex...
For a number of years now I have been unable to get a decent answer to the following question: why are some developers so against checked exceptions. I have had numerous conversations, read things on blog, read what Bruce Eckel had to say (the first person I saw speak out against them).
I am currently writing some new code and paying...
I'm embedding IronPython 2.0 in c#. In IronPython I defined my own exception with:
def foobarException(Exception):
pass
and raise it somewhere with: raise foobarException( "This is the Exception Message" )
now in c# I have:
try
{
callIronPython();
}
catch (Exception e)
{
// How can I determine here the name (foobarException...
I am looking for a reliable way to check to see if a directory contains a Zend_Search_Lucene index. Currently, the only way I have managed to work this out is to check the contents of an exception returned to me using the following code:
<?php
try
{
$newIndex = Zend_Search_Lucene::open( $luceneDir );
} catch ( Zend_Search_Lucene_Exc...
How can I efficiently catch and handle segmentation faults from C in an OSX Carbon application?
Background: I am making an OSX Carbon application. I must call a library function from a third party. Because of threading issues, the function can occasionally crash, usually because it's updating itself from one thread, and it's got some in...
I am fairly new to ASP.NET. I recently set up automated email from my website to notify me of an unhandled exceptions. Just a few hours ago in 3 minutes there were 10 unhandled exceptions and all stack traces were similar. There is a lot in the error messages I do not understand, but I do not like the way this looks.
Here is one of the...
I'm running into an issue where I'm processing unicode strings and I want to do some error reporting with standard exceptions. The error messages contained in standard exceptions are not unicode.
Usually that hasn't been a problem for me because I can define the error message in non-unicode and have enough information, but in this case...
The following catch() is not called:
void test(void)
{
int i=1,j=0,k;
try
{
k = i/j;
}
catch(...)
{
...handle it...
}
}
Is there a way to catch this kind of exception?
...
I have my own exception, which been throwing on execution fail of a method (p/invoke in my case).
public PInvokeException(string methodName)
: base(String.Format(CultureInfo.CurrentCulture,
"An error occured while external method '{0}' call",
methodName)) { }
But I want to replace it with already existing. Is there in FCL something li...
I seem to be missing some information from my stack trace, here is what i'm getting:
at Foo.Bar(DataTable table) in D:\Foo\Bar\authoring\App_Code\FooBar.vb:line 87
Where is the rest of the stack trace infomation?
EDIT:
Custom errors in the Web.Config is set to off, i'm handling the error where it's caught like this:
Catch ex As Ex...
There is a try-catch thing about functions, which I think sometimes may be quite useful:
bool function()
try
{
//do something
}
catch(exception_type & t)
{
//do something
}
So the first part of the question: is this style considered bad in general case?
And the concrete example I used this approach in:
We had project with q...