diff options
author | John Plaxco <john@johnplaxco.com> | 2018-12-22 21:21:28 -0500 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2018-12-23 04:55:28 +0100 |
commit | 53e31c48eefa1e851dbd2017d61578282735f4ce (patch) | |
tree | 5eab4c16b15e60336c7edc44051107156e4009ef /Documentation | |
parent | c38215dfa77fb73f533cf6791461e871d579d0cd (diff) | |
download | subsurface-53e31c48eefa1e851dbd2017d61578282735f4ce.tar.gz |
Improve error reporting when exporting a selection of 0 dives.
If no dives are selected when trying to export a selection, a message
is shown that no dives were selected, but it's immediately hidden
behind a message saying that a temporary file could not be created.
In fact, the creation of the temporary file wasn't never attempted,
so the message that the user actually sees is misleading.
The solution chosen here is to duplicate the check that at least some
dives are selected, and abort early if that case is detected, rather
than continuing on to show the additional misleading message. Not
elegant, but it gets the job done.
Better solutions to this include refactoring prepare_dives_for_divelogs
to return something more descriptive than a bool, remove that check
from prepare_dives_for_divelogs entirely since it doesn't seem to be
a good fit there, or switch to exceptions for handling these problems
rather than return values. I don't have sufficient familiarity with
the codebase to attempt these more invasive changes, but they
should be considered in the future.
On a final note, some of the other error messages in this file start
with a capital letter, but the one relevant to this particular PR
does not. Again, I'm not familiar enough with the codebase (or
translations) to know if that's safe to change, so I'll leave that
for another time or another developer.
Reported-by: John Plaxco
Signed-off-by: John Plaxco <john@johnplaxco.com>
Diffstat (limited to 'Documentation')
0 files changed, 0 insertions, 0 deletions