Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unclear error message for emitter #42

Open
NikStoyanov opened this issue May 7, 2020 · 1 comment
Open

Unclear error message for emitter #42

NikStoyanov opened this issue May 7, 2020 · 1 comment

Comments

@NikStoyanov
Copy link

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:

result = SendResult{ids: ids, status: status}

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

@jbeemster
Copy link
Member

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

status = resp.StatusCode
if oversize {
status = 200
}
result = SendResult{ids: ids, status: status}

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants