MCPcopy Create free account
hub / github.com/aws/aws-cli / _make_error_msg

Function _make_error_msg

tests/functional/docs/test_examples.py:211–233  ·  view source on GitHub ↗
(filename, errors)

Source from the content-addressed store, hash-verified

209
210
211def _make_error_msg(filename, errors):
212 with open(filename) as f:
213 lines = f.readlines()
214 relative_name = filename[len(EXAMPLES_DIR) + 1 :]
215 failure_message = [
216 'The file "%s" contains invalid RST: ' % relative_name,
217 '',
218 ]
219 for error in errors:
220 # This may not always be super helpful because you sometimes need
221 # more than one line of context to understand what went wrong,
222 # but by giving you the filename and the line number, it's usually
223 # enough to track down what went wrong.
224 line_number = min(error['line_number'], len(lines))
225 line_number -= 1
226 if line_number > 0:
227 line_number -= 1
228 current_message = [
229 'Line %s: %s' % (error['line_number'], error['msg']),
230 ' %s' % lines[line_number],
231 ]
232 failure_message.extend(current_message)
233 return '\n'.join(failure_message)
234
235
236def verify_cli_commands_valid(filename, command_validator):

Callers 1

verify_is_valid_rstFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected