Open NikStoyanov opened 4 years ago
Hi @NikStoyanov if there is a status code it does attempt to return it like here for example:
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!
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