Using Custom Exceptions In Functions
Mon 10 August 2026
class FileMissingError(Exception):
pass
def load_config(filename):
if not filename.endswith(".json"):
raise FileMissingError("Only JSON configuration files supported")
load_config("config.txt")
Score: 5
Category: chapter7_custom_exceptions
Read More