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

Enhanced error logging #286

Merged
merged 1 commit into from
Aug 29, 2019
Merged

Enhanced error logging #286

merged 1 commit into from
Aug 29, 2019

Conversation

jwenz723
Copy link
Contributor

Updated the error that is returned to format out as a string rather than a byte slice to be consistent with what is logged on the previous line as well as to make the http response body readable.

Here is an example of what would be returned when an error is encountered:

An example curl request triggering an error response before this PR:

$ curl -X POST -d '{"name": "podinfo","namespace": "test","phase": "Progressing", "metadata": {"type":  "bash","cmd":  "cd /a/non/existant/directory"}}' http://localhost:9090
 exit status 1 [98 97 115 104 58 32 108 105 110 101 32 48 58 32 99 100 58 32 47 97 47 110 111 110 47 101 120 105 115 116 97 110 116 47 100 105 114 101 99 116 111 114 121 58 32 78 111 32 115 117 99 104 32 102 105 108 101 32 111 114 32 100 105 114 101 99 116 111 114 121 10]

An example curl request triggering an error response after this PR:

$ curl -X POST -d '{"name": "podinfo","namespace": "test","phase": "Progressing", "metadata": {"type":  "bash","cmd":  "cd /a/non/existant/directory"}}' http://localhost:9090
 exit status 1 bash: line 0: cd: /a/non/existant/directory: No such file or directory

Updated the formatting of the `out` to be logged as a string rather than a bunch of bytes.
@jwenz723 jwenz723 requested a review from stefanprodan as a code owner August 28, 2019 18:49
Copy link
Member

@stefanprodan stefanprodan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Thanks @jwenz723

@stefanprodan stefanprodan merged commit 4d26971 into fluxcd:master Aug 29, 2019
@stefanprodan stefanprodan mentioned this pull request Sep 8, 2019
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

Successfully merging this pull request may close these issues.

2 participants