rbrito/tunesviewer — Issue #25: Fix if/elif/elif/... chains without else
Author: rbrito
Created: 2012-02-08 01:45:46+00:00
State: open
Labels: Bug, Code enhancement

The code has, in many places, many `if`/`elif`/`elif`/`...`, but they don't end with `else`s.

This is a sign of something fishy: at best, it confuses the reader that is left thinking: "why are the other cases not treated"; at worst, it leads legitimate bugs.

One quick'n'dirty, not-really-a-solution, measure is to give each such chains an `else` statement that simply logs things (using the `logging` infrastructure already in place) when things go wrong (so that we know that there are cases that we are not treating). This may be a measure for the short-term release of version 1.5.

Alternatively, in non-release versions, we can (and should) throw exceptions whenever something reaches such an `else` clause that we don't know yet how to treat, so that the problems become evident upon running the program and trying to get work done.