Skip to content

Do not print anything on error raise an exception instead #19

Closed
@gcq

Description

@gcq

Change this code this code to raise an exception instead of printing to stdout

if not resp.ok:
        try:
            error_msg = "Imgur ERROR message: {}".format(content['error'])
            print(error_msg)
            print("-" * len(error_msg))
        except Exception:
            pass
        resp.raise_for_status()

eg:

if not resp.ok:
        try:
            raise ImgurException("Imgur ERROR message: {}".format(content['error']))
        except Exception:
            resp.raise_for_status()

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