[XQuery Talk Mailing List Archive Home] [By Date] [By Thread] [By Subject] [By Author] [Recent Entries] [Reply To This Message]

What do people do about warnings?

James A. Robinson jim.robinson at stanford.edu
Thu Jan 11 10:32:32 PST 2007


  What do people do about warnings?
If one is writing a library where a condition is encountered which
is not error but which is 'unexpected', I want to log a message
and proceed.  Is fn:trace the best technique for this?  Right now
this is what I came up with:

Some code executing in a 'public' library' might be like:
 
  ... 
  declare function resolve:externalize($uri as xs:anyURI)
  as schema-element(foo:bar)
  {
    if (doc-unavailable($uri))
    then (
       rp:_message($uri, 'resolve:externalize: uri unavailable')
    )
    else (
      let $doc := doc($uri)
      ...
    )  
  }

and in a private library:
  
  (:~
   : Private function to emit a messages. It uses fn:trace to
   : throw a message in an implementation defined method and
   : returns the empty sequence.
   :
   : @param $node a node() to display as part of the message.
   : @param the message to emit.
   : @return the empty sequence.
   :)
  declare function rp:_message($node, $message as xs:string)
  {
    (: Use $w to try and prevent optimizer from throwing this call away. :)
    let $w := trace($node, $message)
    return (
     if ($w) then () else ()
    )
  };

Are there better techniques someone could suggest?

Jim

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
James A. Robinson                       http://x-query.com/mailman/listinfo/talk
Stanford University HighWire Press      http://highwire.stanford.edu/
+1 650 7237294 (Work)                   +1 650 7259335 (Fax)


Purchase Stylus Studio Online Today!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2007 All Rights Reserved.