TruePikachu / pmDJ

Pokémon Mystery DJ - SMD/SWD conversion tools for PMD2
0 stars 2 forks source link

Exceptions in midiFile.* aren't very descriptive #1

Closed TruePikachu closed 10 years ago

TruePikachu commented 10 years ago

There are currently only eight exceptions that will be thrown:

  1. runtime_error("Not a MIDI file")
  2. runtime_error("Only type 1 files supported")
  3. runtime_error("Only 48 tick/beat files supported")
  4. runtime_error("Bad MIDI track header")
  5. runtime_error("Read past end of track wrt size")
  6. runtime_error("Track doesn't end with TRACK_END")
  7. runtime_error("Event type not supported")
  8. logic_error("Wrong MidiEvent::MidiEvent() for eventType") While the first three explain the error nicely, the latter 5 have issues:
    • 4, #5, and #6 don't state which track has an issue

    • 7 and #8 don't give any indication of what event has an issue, nor where said event is

Part of the issue is that I haven't figured out how to gracefully do dynamic error string creation. The other part would be rewriting the exception strings in try..catch blocks to give more context.

It might also be worthwhile to switch some error types for others, but there doesn't appear to be much use in doing so at the present time.

TruePikachu commented 10 years ago

I think I might have smdFile.cpp affected by this as well now. I can get context with gdb, but that isn't very graceful...

TruePikachu commented 10 years ago

Not sure a fix is really plausable for 4..6 and 8. The former deal with malformed .mid files, while the latter deals with a bad constructor choice (because of the multiple forms of MidiEvent::MidiEvent())