code: def error_handler(f):
      
      @wraps(f)
      def inner(*args, **kwargs):
          try:
              return f(*args, **kwargs)
          except NoResultFound:
              abort(404)
          except IntegrityError:
              abort(500)
      return inner
docs: Handle exceptions.