Edirom / Edirom-Online

Edirom Online is a tool for presenting historical-critical music editions in digital form.
GNU General Public License v3.0
19 stars 18 forks source link

Gently fail Edirom Online if no Edition is available in database #335

Open bwbohl opened 1 year ago

bwbohl commented 1 year ago

If no edition is installed in the database the Edirom Online fails ungently with:

<exception>
<path>/db/apps/Edirom-Online/index.xql</path>
<message>err:FODC0005 exerr:ERROR Error. [at line 95, column 5] In function: edition:getPreferencesURI(xs:string) [9:38:/db/apps/Edirom-Online/data/xqm/edition.xqm]</message>
</exception>

This should be caught and a statement, e.g., "no edition available in the database", should be printed.

bwbohl commented 3 months ago

The current design of index.xql always assumes that there is at least one Edirom Edition installed in the database. Consequently, index.xql will always produce an error when trying to fetch the name of that single edition via preferences, as no preferences can be found…

This logic probably should be handled via eXist-db controller.xql and forward to different templates depending on:

  1. whether an edition ID was submitted in the request
  2. if multiple editions were found in the database
  3. if a single edition was found
  4. if no edition was found