cyberrumor / ammo

Almost Manual Mod Organizer - Linux MO for Bethesda Games
GNU General Public License v2.0
32 stars 6 forks source link

Reduce return types by raising errors instead of returning False #22

Closed cyberrumor closed 1 year ago

cyberrumor commented 1 year ago

Currently, the UI is set up to prompt for [Enter] whenever a method returns false, and to restart the main loop whenever a method returns successfully. This is a bad pattern because functions in the controller have to have multiple return types. They must either return the requested data, or return False.

A better pattern would be to return the requested data, or to raise an error. This solves the issue of having multiple return types.

The UI could then be responsible for catching specific exceptions and handling them appropriately.