← Back to team overview

zorba-coders team mailing list archive

[Merge] lp:~zorba-coders/zorba/xqdoc_exception_handling into lp:zorba

 

Sorin Marian Nasoi has proposed merging lp:~zorba-coders/zorba/xqdoc_exception_handling into lp:zorba.

Requested reviews:
  Sorin Marian Nasoi (sorin.marian.nasoi)

For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/xqdoc_exception_handling/+merge/102496

Added try/catch for errors in the module processing.
-- 
https://code.launchpad.net/~zorba-coders/zorba/xqdoc_exception_handling/+merge/102496
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'modules/com/zorba-xquery/www/modules/project_xqdoc.xq'
--- modules/com/zorba-xquery/www/modules/project_xqdoc.xq	2012-04-16 20:56:43 +0000
+++ modules/com/zorba-xquery/www/modules/project_xqdoc.xq	2012-04-18 11:36:52 +0000
@@ -112,13 +112,15 @@
     if(count($moduleManifests) eq xs:integer(0)) then ();
     else
     {
+      try 
+      {
       for $module in $moduleManifests
       (: note the module version is not supported because of a bug in the fetch for the module URI ending with / :)
       (:let $moduleURI := if(ends-with(data($module/zm:uri),'/')) then data($module/zm:uri) 
                        else if(exists($module/@version)) then concat(data($module/zm:uri),"#",data($module/@version))
                        else data($module/zm:uri):)
       (:let $moduleFetched := fetch:content(trace($moduleURI,"fetch module URI version.."), "MODULE"):)
-      let $moduleURI := if(ends-with(data($module/zm:uri),".xq")) then substring-before(data($module/zm:uri),".xq") else data($module/zm:uri)
+      let $moduleURI := data($module/zm:uri)
       let $moduleFetched := fetch:content($moduleURI, "MODULE")
       let $xqdoc := xqd:xqdoc-content($moduleFetched)
       let $xqdocRelFileName  := pxqdoc:get-filename($moduleURI)
@@ -127,6 +129,15 @@
         file:write($xqdocFileName,
                    $xqdoc, 
                    $pxqdoc:serParamXml)
+      }
+      catch *
+      {
+        fn:error($err:UE004,
+                 concat("Error processing module ",
+                        $werr:code,
+                        " - ",
+                        $werr:description))
+      }
     };
   }  
 };


Follow ups