Commit e1f216d9 authored by Jerome Chauveau's avatar Jerome Chauveau
Browse files

catch repo:not found exception

parent 401c3ff1
Loading
Loading
Loading
Loading
+11 −7
Original line number Diff line number Diff line
@@ -8,6 +8,7 @@ module namespace utils = "https://certic.unicaen.fr/max/utils";

import module namespace conf = 'https://certic.unicaen.fr/max/conf';
import module namespace database = 'https://certic.unicaen.fr/max/database';
import module namespace errors = 'https://certic.unicaen.fr/max/errors';

(:~ locales dir:)
declare variable $utils:locales_dir := "locales/";
@@ -22,6 +23,7 @@ declare function utils:doc-to-html($collection as xs:string?, $doc as xs:string,
    (:
     - exécute la fonction doc-to-html du bundle de vocabulaire actif
    :)
    try{
        let $ns := conf:get-vocabulary-namespace()
        let $declaration := "declare variable $doc external; declare variable $lang external;"
        let $import := "import module namespace vocabulary = '"|| $ns ||"';"
@@ -29,6 +31,8 @@ declare function utils:doc-to-html($collection as xs:string?, $doc as xs:string,
        let $doc := database:get-document($collection || '/' || $doc || '.xml')
        let $query := 'vocabulary:doc-to-html($doc, $lang)'
        return xquery:eval($import ||  $declaration || $query, map {'doc' : $doc, 'lang': $lang})
    }
    catch repo:not-found {errors:error($err:code, $err:description, $err:line-number, $lang)}
};