Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to display errors? #92

Open
carniz opened this issue Apr 12, 2023 · 0 comments
Open

How to display errors? #92

carniz opened this issue Apr 12, 2023 · 0 comments

Comments

@carniz
Copy link

carniz commented Apr 12, 2023

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))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant