R
Rob Richardson
Greetings!
I am working on an application that targets a Pocket PC running Windows CE
and SQL Server CE. Almost all functions in the application use a Try block
with a Catch block that looks like this:
Try
TryToDoIt()
Catch e as Exception
LogTheError(e)
Throw e
End Try
I would like a little more intelligence in this. I wrote a little routine
that generates a message showing expanded error information if the exception
is an SqlCeException. But I'd rather not add a second catch block to all of
the places where an SqlCeException could be thrown. For one thing, that
would be labor-intensive. For another thing, if this app is ever migrated
to a desktop, I'd have to add another catch block for SqlExceptions, and if
it's ported to Microsoft Access (God forbid), I'd have to add
OleDbExceptions, and so on.
So, I was hoping to do something like this:
Throw CType(e, TypeName(e))
so that when it got up to the next call in the call stack, it would be an
SqlCeException instead of just an Exception. Of course, that doesn't work,
since the type name has to be a type instead of a character string that
happens to hold a name type. Is there a way to do what I want?
Thanks very much!
Rob
I am working on an application that targets a Pocket PC running Windows CE
and SQL Server CE. Almost all functions in the application use a Try block
with a Catch block that looks like this:
Try
TryToDoIt()
Catch e as Exception
LogTheError(e)
Throw e
End Try
I would like a little more intelligence in this. I wrote a little routine
that generates a message showing expanded error information if the exception
is an SqlCeException. But I'd rather not add a second catch block to all of
the places where an SqlCeException could be thrown. For one thing, that
would be labor-intensive. For another thing, if this app is ever migrated
to a desktop, I'd have to add another catch block for SqlExceptions, and if
it's ported to Microsoft Access (God forbid), I'd have to add
OleDbExceptions, and so on.
So, I was hoping to do something like this:
Throw CType(e, TypeName(e))
so that when it got up to the next call in the call stack, it would be an
SqlCeException instead of just an Exception. Of course, that doesn't work,
since the type name has to be a type instead of a character string that
happens to hold a name type. Is there a way to do what I want?
Thanks very much!
Rob