Skip to content

Bad error messages for invalid staff text characters #337

@PhoenixBound

Description

@PhoenixBound

If the user tries to type text in the staff credits (Staff/staff_text.md), in Debug Mode, the following error will display:

Reading staff text
Traceback (most recent call last):
  File "coilsnake\ui\gui.py", line 304, in _do_compile_help
  File "coilsnake\ui\common.py", line 159, in compile_project
  File "coilsnake\modules\eb\StaffModule.py", line 247, in read_from_project
  File "coilsnake\modules\eb\StaffModule.py", line 165, in read_staff_text_from_project
  File "coilsnake\modules\eb\StaffModule.py", line 114, in read_small_line_from_project
  File "coilsnake\modules\eb\StaffModule.py", line 108, in read_text_line_from_project
KeyError: '9'

'9'

(There's probably a similar traceback for both small and large text.)

Outside of debug mode, all the user sees is the text '9' for the error (the invalid character). That's super confusing. Properly catch the KeyErrors in these dictionary lookups and raise an appropriate exception from them that gives more context (line number, or the full line of text, or the relevant file/module, or... something).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions