[SOLVED] SIE508 - HW   5 -   Exceptions 

30.00 $

Category:

Description

5/5 - (1 vote)

Assignment    

 

  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.

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.

  1. 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?
  2. ModelBasic needs    to            handle  any        exceptions          that        py           might    raise                and        raise      exceptions          itself      around critical code      blocks.
  3. Check for          additional           critical blocks  you        could    find        opportunities    for          exception   .