> -----Original Message-----
> From: Alan Gates [mailto:[EMAIL PROTECTED]
> Sent: Friday, February 29, 2008 9:05 AM
> To: [email protected]
> Subject: Re: Proposal for error handling in Pig
>
>
> On Feb 29, 2008, at 7:04 AM, Benjamin Francisoud wrote:
>
> > About Internal Errors, do you consider such code to be part
> of them ?
> >
> > public void something(Object object) {
> > if (o == null) {
> > throw new IllegalArgumentException("Object can't be null");
> > }
> > ...
> > }
> >
> > class StateMachine {
> > public void start() {...}
> > public void end() {
> > if (startCalled == false) {
> > throw new IllegalStateException("You didn't call
> start()");
> > }
> > }
> > }
> I would say these are internal errors. Anytime you can say
> to yourself, "this should never happen", it's an internal
> error. Another way to think of it is that you should only
> get that error if there is a bug in the code (e.g. someone
> called your function and passed a null reference, which your
> function explicitly said it didn't support).
> Errors that can be arrived at by user action or external
> conditions (parse error, file not found, etc.) are never
> internal errors.
One thing that I need to clarify in the document is that
RuntimeException itself or its derivation can be used in this case. I
will do that.
>
> >
> > About user errors, how should we handle them ?
> > The way I proposed in PIG-100 (1) ?
> >
> > try {
> > plan = parser.Parse();
> > } catch (ParseException e) {
> > log.error(e.getMessage());
> > log.debug(e);
> > }
> After a user error control should return to whoever called
> PigServer, as pig can no longer do anything intelligent. It
> seems reasonable to let the error go through in this case,
> and let the caller of PigServer (whether that's Grunt or a
> user's code) deal with the exception.
Yes, that was my intent, if this was not clear, feel free to update the
text.
>
> Alan.
>
>