Ticket - Handling Errors

The code was
# TODO: Error Handling
# If an invalid ID is passed to get_movie, it should return None.
except (StopIteration) as _:
return None

    Ticket: Error Handling

    Handle the InvalidId exception from the BSON library the same way as the
    StopIteration exception is handled. Both exceptions should result in
    `get_movie` returning None.
except bson.errors.InvalidId:
    return None

It passed “pytest -m error_handling”, but it cannot generate a validation code at the “status” page.

There is a chance that you are using the outdated version mflix. Download the new copy, copy and paste your db.py from the old to the new and try again.

I have gotten this as well until I downloaded the new version.

1 Like

Where is this new copy that you’re talking about?

Go to “Chapter 0”, click on Handouts button and download the new version.