Skip to content

How to display errors? #92

Description

@carniz

What's the best way to show errors, in case they should occur?

I've tried to use PromptUtils.println(), but I can't seem to make it work.

Example code:

def add_supplier() -> None:
    try:
        new_supplier = read_supplier_df()
        df = pd.concat([df, new_supplier])
        df.to_csv(SUPPLIERS_FILE_PATH)  # could fail if the directory is not writable
    except Exception as ex:
        PromptUtils(Screen()).println(ex)  # Display the full exception

main_menu.append_item(FunctionItem("Add supplier", add_supplier))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions