snowplow-golang-tracker icon indicating copy to clipboard operation
snowplow-golang-tracker copied to clipboard

Unclear error message for emitter

Open NikStoyanov opened this issue 4 years ago • 1 comments

When there is an error with sending a POST/GET requests the tracker returns a status code of -1. This makes debugging harder when using containers without inspecting the logs.

The return of the status is done in: https://github.com/snowplow/snowplow-golang-tracker/blob/50e2f03c3f5c2afb6b3b252d49ab75af987e1b52/tracker/emitter.go#L357

Which defaults to -1 when the status code is not OK 200, instead of the real value.

For comparison the Python tracker returns the status code with the warning message: https://github.com/snowplow/snowplow-python-tracker/blob/91da00a0549f05169b179c819028409d3d3f7401/snowplow_tracker/emitters.py#L195

NikStoyanov avatar May 07 '20 14:05 NikStoyanov

Hi @NikStoyanov if there is a status code it does attempt to return it like here for example:

https://github.com/snowplow/snowplow-golang-tracker/blob/50e2f03c3f5c2afb6b3b252d49ab75af987e1b52/tracker/emitter.go#L363-L367

The -1 is for a quick return in the case of the request failing entirely - in which case it is likely that there is no accurate status code to return.

In any case if you have an idea for how to improve the code we would welcome a PR that surfaces the error more clearly!

jbeemster avatar May 07 '20 15:05 jbeemster