Description
Exceptions
1. Add appropriate exceptions and exception handling to persistent basic_backend.py and Model.py.
In this homework assignment, we revisit the basic_backend.py and the Model.py (code is attached). In this version, the basic_backend.py provides a CRUD interface that stores items to a file. The ModelBasic inherits from Model and currently has no exception handling, that is, it does not catch any exception that the basic_backend.py might raise.
Assignment: Introduce your own, new exceptions for the Model class. It is not really necessary since Model could raise the same exceptions as basic_backend.py. However, this is an assignment to get some experience with exception writing, using and handling. Make sure, Model raises its own exceptions that convey useful error messages.
- A) Â Basic_backend.py needs to be equipped to handle FileIO errors and do the appropriate exception handling for this code. Are there other places to add exception handling?
- B) Â ModelBasic needs to handle any exceptions that basic_backend.py might raise and raise exceptions itself around critical code blocks.
- C) Â Check for additional critical blocks you could find opportunities for exception handling.
Deliverables for this HW assignment:
1. all necessary .py files in a .zip file