Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Side effects to creating but not throwing an exception

Reply
Thread Tools

Side effects to creating but not throwing an exception

 
 
Rob
Guest
Posts: n/a
 
      07-01-2008
Are there any side effects to creating but not throwing an exception?

Thanks for your help,
Rob
 
Reply With Quote
 
 
 
 
Knute Johnson
Guest
Posts: n/a
 
      07-01-2008
Rob wrote:
> Are there any side effects to creating but not throwing an exception?
>
> Thanks for your help,
> Rob


About the same as creating any other object I would guess.

Just for my curiosity, what are you really doing?

--

Knute Johnson
email s/nospam/knute2008/

--
Posted via NewsDemon.com - Premium Uncensored Newsgroup Service
------->>>>>>http://www.NewsDemon.com<<<<<<------
Unlimited Access, Anonymous Accounts, Uncensored Broadband Access
 
Reply With Quote
 
 
 
 
Rob
Guest
Posts: n/a
 
      07-01-2008
On Jul 1, 4:12 pm, Knute Johnson <(E-Mail Removed)>
wrote:
> Rob wrote:
> > Are there any side effects to creating but not throwing an exception?

>
> > Thanks for your help,
> > Rob

>
> About the same as creating any other object I would guess.
>
> Just for my curiosity, what are you really doing?
>
> --
>
> Knute Johnson
> email s/nospam/knute2008/
>
> --
> Posted via NewsDemon.com - Premium Uncensored Newsgroup Service
> ------->>>>>>http://www.NewsDemon.com<<<<<<------
> Unlimited Access, Anonymous Accounts, Uncensored Broadband Access


I have a set the exception message to a different value in one special
case. I figured I could either pass a boolean through several calls
to get to where the exception is thrown or I could examine the stack
trace to see if a particular class is in the call stack which will
tell me if I should change the exception message. It is an ugly hack,
but probably the least unpleasant of several unpleasant alternatives.

Thanks,
Rob
 
Reply With Quote
 
Patricia Shanahan
Guest
Posts: n/a
 
      07-01-2008
Rob wrote:
....
> I have a set the exception message to a different value in one special
> case. I figured I could either pass a boolean through several calls
> to get to where the exception is thrown or I could examine the stack
> trace to see if a particular class is in the call stack which will
> tell me if I should change the exception message. It is an ugly hack,
> but probably the least unpleasant of several unpleasant alternatives.


There is a third option. Throw a fixed exception based on what the
method detecting the problem knows. Higher up the stack, at the level
where you would be selecting the value of the boolean, catch it and
throw a new exception, incorporating additional data or the changed
message, with the original exception as its cause.

Patricia
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
wsdl2py throwing error while creating client side code Shan Python 1 05-22-2008 12:06 PM
WebRequest.GetResponse() throwing exception (Internal Server error =?Utf-8?B?VGVycnk=?= ASP .Net 4 01-13-2005 10:25 PM
Problem of throwing an exception (System.Net.Sockets.OverlappedAsyncResult::CompletionPortCallback) VincentWong ASP .Net 1 12-29-2003 09:32 AM
Throwing Exception in a composite control KJ ASP .Net 5 07-25-2003 01:33 PM



Advertisments