What happens
Every failed request writes two lines to stderr. The client log line comes
first. The JSON error message from the CLI comes second.
$ dm run status 999999
Error when calling API: {'detail': 'The requested run was not found.'}
{"error": {"code": "error", "message": "Request failed: The requested run was not found."}}
Why this is a problem
The README says that stderr carries only the JSON error message. A parser
that reads stderr as JSON fails on the first line. The line contains the full
response body, so a server 500 puts its complete error page on stderr. That
page can be some hundreds of kilobytes.
Cause
_raise_for_status in datamasque-python logs the full response body at
ERROR level. The CLI adds no handler to the datamasque logger. The
last-resort handler in Python then prints the record to stderr.
Suggested fix
Add these two lines to main():
logging.getLogger("datamasque").addHandler(logging.NullHandler())
logging.getLogger("datamasque").propagate = False
Source
Found here.
What happens
Every failed request writes two lines to stderr. The client log line comes
first. The JSON error message from the CLI comes second.
$ dm run status 999999
Error when calling API: {'detail': 'The requested run was not found.'}
{"error": {"code": "error", "message": "Request failed: The requested run was not found."}}
Why this is a problem
The README says that stderr carries only the JSON error message. A parser
that reads stderr as JSON fails on the first line. The line contains the full
response body, so a server 500 puts its complete error page on stderr. That
page can be some hundreds of kilobytes.
Cause
_raise_for_statusindatamasque-pythonlogs the full response body atERROR level. The CLI adds no handler to the
datamasquelogger. Thelast-resort handler in Python then prints the record to stderr.
Suggested fix
Add these two lines to
main():Source
Found here.