comp.lang.ada
 help / color / mirror / Atom feed
* OWN EXCEPTION NOT HANDLED
@ 2005-11-30 11:48 rashmi
  2005-11-30 12:45 ` Stephen Leake
  2005-12-01  2:34 ` Steve
  0 siblings, 2 replies; 4+ messages in thread
From: rashmi @ 2005-11-30 11:48 UTC (permalink / raw)


Dear reader

Inside a function I defined an exception of my own that is equivalent
to an exception of  constraint- error type. I have also created the
associated exception handler as shown next:
_________________
    :
if RE_ScDSGA.IN_RanSeq <  0   then raise EX_RsqIvd; end if;
if RE_ScDSGA.IN_RanSeq >  1   then raise EX_RsqIvd; end if;
    :
    :
exception
    when EX_RsqIvd => put_line("EXCEPTION: Invalid key INPUT for random
seq");
return RE_ScDSGA;
    :
___________________

There were no compiler errors or warnings. Now when a value of 2 was
supplied for the field variable IN_RanSeq, a constraint error would be
expected. But instead of handling this constraint error as I have
defined above, Ada handled it on its own by raising Constraint_Error.

My question is how do I get Ada to handle the constraint error from my
own handler rather than from the handler of its own?




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: OWN EXCEPTION NOT HANDLED
  2005-11-30 11:48 OWN EXCEPTION NOT HANDLED rashmi
@ 2005-11-30 12:45 ` Stephen Leake
  2005-12-01 10:34   ` rashmi
  2005-12-01  2:34 ` Steve
  1 sibling, 1 reply; 4+ messages in thread
From: Stephen Leake @ 2005-11-30 12:45 UTC (permalink / raw)


"rashmi" <rashmi.thoras@gmail.com> writes:

> Dear reader
>
> Inside a function I defined an exception of my own that is equivalent
> to an exception of  constraint- error type. I have also created the
> associated exception handler as shown next:
> _________________
>     :
> if RE_ScDSGA.IN_RanSeq <  0   then raise EX_RsqIvd; end if;
> if RE_ScDSGA.IN_RanSeq >  1   then raise EX_RsqIvd; end if;
>     :
>     :
> exception
>     when EX_RsqIvd => put_line("EXCEPTION: Invalid key INPUT for random
> seq");
> return RE_ScDSGA;
>     :
> ___________________
>
> There were no compiler errors or warnings. Now when a value of 2 was
> supplied for the field variable IN_RanSeq, a constraint error would be
> expected. But instead of handling this constraint error as I have
> defined above, Ada handled it on its own by raising Constraint_Error.
>
> My question is how do I get Ada to handle the constraint error from my
> own handler rather than from the handler of its own?

We need to see the full code to be able to answer this;
Constraint_Error must be raised on some line you are not showing.

-- 
-- Stephe



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: OWN EXCEPTION NOT HANDLED
  2005-11-30 11:48 OWN EXCEPTION NOT HANDLED rashmi
  2005-11-30 12:45 ` Stephen Leake
@ 2005-12-01  2:34 ` Steve
  1 sibling, 0 replies; 4+ messages in thread
From: Steve @ 2005-12-01  2:34 UTC (permalink / raw)


"rashmi" <rashmi.thoras@gmail.com> wrote in message 
news:1133351325.417716.228260@g43g2000cwa.googlegroups.com...
> Dear reader
>
> Inside a function I defined an exception of my own that is equivalent
> to an exception of  constraint- error type. I have also created the
> associated exception handler as shown next:
> _________________
>    :
> if RE_ScDSGA.IN_RanSeq <  0   then raise EX_RsqIvd; end if;
> if RE_ScDSGA.IN_RanSeq >  1   then raise EX_RsqIvd; end if;
>    :
>    :
> exception
>    when EX_RsqIvd => put_line("EXCEPTION: Invalid key INPUT for random
> seq");
> return RE_ScDSGA;
>    :
> ___________________
>
> There were no compiler errors or warnings. Now when a value of 2 was
> supplied for the field variable IN_RanSeq, a constraint error would be
> expected. But instead of handling this constraint error as I have
> defined above, Ada handled it on its own by raising Constraint_Error.
>
> My question is how do I get Ada to handle the constraint error from my
> own handler rather than from the handler of its own?
>

Try:
  when Constraint_Error =>

Steve
(The Duck)





^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: OWN EXCEPTION NOT HANDLED
  2005-11-30 12:45 ` Stephen Leake
@ 2005-12-01 10:34   ` rashmi
  0 siblings, 0 replies; 4+ messages in thread
From: rashmi @ 2005-12-01 10:34 UTC (permalink / raw)


I just discovered that the exception's message was output in the file
specified by set_output(...). So I believe the problem is resolved for
now. Thanks for the suggestions anyway.




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2005-12-01 10:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-11-30 11:48 OWN EXCEPTION NOT HANDLED rashmi
2005-11-30 12:45 ` Stephen Leake
2005-12-01 10:34   ` rashmi
2005-12-01  2:34 ` Steve

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox