Developer Notes

Handling Invalid music-list.php Requests

During development of music-list.php, the page originally defaulted to displaying the archive by title whenever it received an unrecognised or incomplete URL request.

For example, if a programming error generated an incorrect URL, the page would still display a perfectly valid list of tracks ordered by title. Although this avoided a PHP error, it also hid the underlying problem.

The decision was therefore made to change this behaviour.

Design Principle

When something unexpected happens, fail visibly rather than quietly doing something else.

Returning an apparently correct page when an invalid request has been made can make programming errors much harder to detect and may confuse users who receive results different from those they expected.

Planned Behaviour

The page should explain that the requested list could not be generated and, where appropriate, encourage the visitor to report the problem if they followed a link from elsewhere on the website.

For diagnostic purposes the page may also display the values that were received, for example:

view=xyz
value=abc

Future Development

Rather than immediately creating an error_logs table, a more flexible approach would be to introduce a general site_log table capable of recording a variety of events throughout the website.

Possible categories could include:

This broader approach would provide a reusable logging system for the entire website rather than one designed solely for music-list.php.

Implementation Strategy

  1. Remove the current default behaviour of listing tracks by title.
  2. Display a clear, user-friendly message whenever an invalid request is received.
  3. Implement a reusable logging system later, once several areas of the website can benefit from it.

This follows the general philosophy adopted throughout the project: first make the behaviour correct and understandable, then introduce reusable infrastructure when there is a genuine need for it.