Less confusing 404 errors from /random endpoint

Before this fix the /random endpoint could return a 404 Not Found page
saying

  The requested URL "/random" was not found on this server.

Error cases producing such a result were:

- `/random?content=NON-EXISTING-BOOK` (can happen when a server is
restarted or the library is reloaded and the current book is no longer
available).

- Failure of the libkiwix routine for picking a random article.

Now a proper message is shown for each of those cases.
This commit is contained in:
Veloman Yunkan
2021-12-11 20:54:16 +04:00
committed by Matthieu Gautier
parent d21879ebda
commit f7b853373c
3 changed files with 10 additions and 4 deletions

View File

@ -6,9 +6,11 @@
</head>
<body>
<h1>Not Found</h1>
{{#url}}
<p>
The requested URL "{{url}}" was not found on this server.
</p>
{{/url}}
{{#details}}
<p>
{{{details}}}