Closed david-pershouse closed 1 year ago
This has now been changed to obey the --output
argument. This required some refactoring of the printer classes. The main change is the introduction of an error() method to the printers which is like print but outputs to stderr. The error function renders any tables including their headings and with all fields (as it is assumed the these options were specific to success response types).
To avoid passing output file down to each subclass of printer, the printer sub-classes now just return string.
I tried to use the built in "title" property of terminaltables
, but could not get it to render correctly (or at all) in windows, so this PR just prints a single line title.
The bulk of this was addressed in #10
When a request receives a response with 4xx or 5xx status codes, it is now treated as an error and
bl
will return error level of -1. This MR also applies custom formatting to the ProblemDetails and ValidationProblemDetails objects that are common in the error response.ProblemDetails (usually with 5xx errors) is just rendered as
ERROR: {title} - {detail}
where detail is optionaleg for a 404
ValidationProblemDetails (4xx validation errors) is similar to problem details, but includes the
errors
property as a table