On Mon, Mar 07, 2011 at 03:25:35PM +0000, Ian Wright wrote:
> if you call atomdb:create-member on a collection which doesn't exist
> then it will return nothing
> e.g.
> atomdb:create-member( "/groups" ....
Yes, currently most functions in the atomdb module indicate failure by
returning the empty sequence.
I don't know of any way to throw an exception from within XQuery, so when
I coded this initially I couldn't think of any other way to indicate error.
However, now I can think of at least two alternatives...
1. write a custom xquery function to throw an exception, then modify atomdb
to use exception throwing as the way of signalling error. this would mean
that you'd have to wrap your calling code in util:catch(...).
2. return an <error> XML fragment to indiciate an error. your calling code
would then do something like...
let $foo := atomdb:create-member('bar'...)
return
if ($foo instance of element(error)) then (: handle error :)
else (: handle success :)
got any preferences?
cheers,
Alistair
--
Alistair Miles
Head of Epidemiological Informatics
Centre for Genomics and Global Health <http://cggh.org>
The Wellcome Trust Centre for Human Genetics
Roosevelt Drive
Oxford
OX3 7BN
United Kingdom
Web: http://purl.org/net/aliman
Email: alim...@gmail.com
Tel: +44 (0)1865 287669