looker-open-source / actions

MIT License
62 stars 103 forks source link

adds error message utility to help format errors #602

Closed ehdunbar closed 5 months ago

ehdunbar commented 5 months ago

For GCS errors e.code can be either a number such as 403, or a status string such as ECONNRESET. This adds a utility function that maps the status string or status code to the proper error definition we have created.

Example of logs that will be fixed with this change:

{ 
error: Internal server error. [Google Cloud Storage] undefined, 
http_code: 500, 
status_code: 403, 
message: Internal server error.
}
{
error: Internal server error. [Google Cloud Storage] undefined,
http_code: 500, 
status_code: ECONNRESET, 
message: Internal server error.
}

https://pantheon.corp.google.com/logs/query;query=SEARCH%2528%22gcs%22%2529;storageScope=storage,projects%2Factionhubpp-production%2Flocations%2Fglobal%2Fbuckets%2F_Default%2Fviews%2F_AllLogs;cursorTimestamp=2024-06-06T07:00:09.782322Z;duration=P7D?project=actionhubpp-production&e=13803378&jsmode=O&mods=monitoring_api_prod