abdera-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From James M Snell <jasn...@gmail.com>
Subject Re: Document<Error>
Date Mon, 13 Aug 2007 16:49:19 GMT
Ok, I just checked this in.  It has been added to the protocol module.

  Abdera abdera = new Abdera();
  Error error = Error.create(abdera, 123, "Some error message");
  Document<Error> doc = error.getDocument();

Once you have the Error object, you can use it to throw an exception:

  error.throwException();

This will throw a ProtocolException (extends RuntimeException) that
pulls it's info from the Error object.  This is useful mainly on the
client side when an Error is returned and the client wishes to surface
it using regular Java error handling.

You can also use the Factory to create a standalone Error element.

  Error error = abdera.getFactory().newElement(Error.ERROR);

The Error object extends ExtensibleElementWrapper so you can add
extension elements.

- James

Chris Berry wrote:
> Greetings,
> I was wondering if it might make sense to formalize the Error document
> that Abdera returns, so that we could use Document<Error> in clients and
> servers??
> Thanks,
> -- Chris
> 
> S'all good  ---   chriswberry@gmail.com
> 
> 
> 
> 

Mime
View raw message