MCPcopy
hub / github.com/aws/aws-cli / format_error

Method format_error

awscli/errorhandler.py:52–73  ·  view source on GitHub ↗
(self, error_info, stream)

Source from the content-addressed store, hash-verified

50
51class EnhancedErrorFormatter:
52 def format_error(self, error_info, stream):
53 additional_fields = self._get_additional_fields(error_info)
54
55 if not additional_fields:
56 return
57
58 stream.write('\nAdditional error details:\n')
59 has_complex_value = False
60 for key, value in additional_fields.items():
61 if self._is_simple_value(value):
62 stream.write(f'{key}: {value}\n')
63 elif self._is_small_collection(value):
64 stream.write(f'{key}: {self._format_inline(value)}\n')
65 else:
66 stream.write(f'{key}: <complex value>\n')
67 has_complex_value = True
68
69 if has_complex_value:
70 stream.write(
71 'Use "--cli-error-format json" or another error format '
72 'to see the full details.\n'
73 )
74
75 def _is_simple_value(self, value):
76 return isinstance(value, (str, int, float, bool, type(None)))

Calls 5

_is_simple_valueMethod · 0.95
_is_small_collectionMethod · 0.95
_format_inlineMethod · 0.95
writeMethod · 0.45