implementing function generating_exceptions()