Permalink
Browse files

[ADD] Error handling for parser Errors

-…still no support for BaseX’ map syntax.
  • Loading branch information...
1 parent 6c12184 commit 69ea4d3b67cd564a9ac87ba0978e3e859094c438 @micheee committed Apr 30, 2012
Showing with 14 additions and 4 deletions.
  1. +6 −1 lib/xquery-update-30.xquery
  2. +8 −3 www/docs.xqm
@@ -12403,7 +12403,12 @@ declare function p:parse-XQuery($s as xs:string) as item()*
let $error := $state[$p:error]
return
if ($error) then
- element ERROR {$error/@*, p:error-message($s, $error)}
+ (:
+ fn:error( $error as xs:QName?,
+ $description as xs:string,
+ $error-object as item()*) as none
+:)
+ error( xs:QName("XQPARSER"), p:error-message($s, $error), $s)
else
subsequence($state, $p:result)
};
View
@@ -44,6 +44,9 @@ function docs:docs(){
)
};
+(:~
+: *TODO*
+:)
declare function docs:nav($path){
let $files := wdoc:process-dir($path, false())
for $file in $files
@@ -75,7 +78,7 @@ function docs:docs($file as xs:string){
declare function docs:generate($path as xs:string, $file as xs:string){
try {(
<a name="{$file}"/>,
- <h2>{$file}</h2>,
+ <h2>{$file} </h2>,
let $module := p:parse-XQuery(file:read-text($path||$file))
for $function in $module//AnnotatedDecl
let $comment := d:parse-Comments($function/text())
@@ -90,14 +93,16 @@ declare function docs:generate($path as xs:string, $file as xs:string){
}
catch * {
<p>
- <h2>Error</h2>
- <a class="btn btn-danger"> Error [{$err:code}]:</a> $err:description
+ <a class="btn btn-danger"> Error [{$err:code}]</a>
+ <dl class="">
+ <dt>{ $err:description}</dt> <dd>in {$err:module} @{$err:line-number}:{$err:column-number}</dd></dl>
</p>
}
};
(:~
Wraps $content in a template.
+ @param $content the elements to wrap
:)
declare function docs:template($content as element(*)+){
let $config := doc('config.xml')/config,

0 comments on commit 69ea4d3

Please sign in to comment.