code: def handle_exc(exc):
      
  
      err = ERRORS_TABLE.get(exc.pgcode)
  
      if err:
          abort(exceptions.InvalidQueryParams(**{
              'detail': err,
              'parameter': 'filter',
          }))
  
      abort(exceptions.DatabaseUnavailable)
docs: Given a database exception determine how to fail
  
      Attempt to lookup a known error & abort on a meaningful
      error. Otherwise issue a generic DatabaseUnavailable exception.
  
      :param exc: psycopg2 exception