google / earthenterprise

Google Earth Enterprise - Open Source
Apache License 2.0
2.67k stars 889 forks source link

Invalid variables when reporting postgres errors #1861

Closed tst-lsavoie closed 3 years ago

tst-lsavoie commented 3 years ago

There are several variable naming errors in the function _GetAllAssets in earth_enterprise/src/server/wsgi/serve/publish/publish_manager_helper.py. Here is a part of the function:

    except psycopg2.Warning as w:
      logger.error(w)
      http_io.ResponseWriter.AddJsonFailureBody(response, str(e))
    except psycopg2.Error as e:
      logger.error(e)
      http_io.ResponseWriter.AddJsonFailureBody(response, str(w))

Note that in the first except statement the variable is called w, but in the Json response it is using the variable e. In the second except statement it has the same problem in reverse. We need to clean this up so that it always uses the correct variable.