Skip to content

Commit

Permalink
return 404 when no file with ID
Browse files Browse the repository at this point in the history
cf. #343 #304 #193
closes #336
  • Loading branch information
dariok committed Apr 3, 2024
1 parent d331426 commit d2dee54
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions edoc/modules/error.xqm
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import module namespace functx = "http://www.functx.com"


declare function wdbErr:error ( $data as map (*) ) as item()+ {
let $error := switch (xs:string($data("code")))
let $error := switch ( xs:string($data("code")) )
case "wdbErr:wdb0000"
case "wdb0000"
return "No file could be found for the ID supplied in the request: " || $data("err:value")?id
Expand All @@ -33,11 +33,11 @@ declare function wdbErr:error ( $data as map (*) ) as item()+ {
case "wdbErr:wdb3001" return "Error creating model in function.xqm"
default return "An unknown error has occurred: " || $data("code")

let $statusCode := if ( xs:string($data?code) = ("wdbErr:wdb0200", "wdbErr:wdb0000") )
let $statusCode := if ( xs:string($data?code) = ("wdbErr:wdb0200", "wdbErr:wdb0000", "wdbErr:wdb0404") )
then 404
else 418

let $errorContent := if ( xs:string($data?code) = "wdbErr:wdb0200" )
let $errorContent := if ( $statusCode = 404 )
then
<div>
<h1>Seite nicht gefunden</h1>
Expand Down

0 comments on commit d2dee54

Please sign in to comment.