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

2.x: Client option to log full reason for HTTP errors #368

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

RiskoZoSlovenska
Copy link
Contributor

2.x backport of #319.

@SinisterRectus
Copy link
Owner

I will review and possibly include this after 2.11.0.

client:error('%i - %s : %s %s', res.code, res.reason, method, url)
local errMsg = f('%i - %s : %s %s', res.code, res.reason, method, url)
if self._logFullErrors then
errMsg = errMsg .. "\n" .. msg
Copy link
Owner

Choose a reason for hiding this comment

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

Shouldn't need to concat here. Take advantage of the logger's formatter.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure what you mean. Something like

if logFullErrors then
    client:error(errMsg)
else
    client:error("%s\n%s", errMsg, msg)
end

?

self._client = client
self._mutexes = setmetatable({}, mutexMeta)
self._logFullErrors = logFullErrors
Copy link
Owner

Choose a reason for hiding this comment

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

Don't store this here. Just use the options table in the commit method.

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