| 191 | |
| 192 | |
| 193 | class ClientExceptionsDocumenter: |
| 194 | _USER_GUIDE_LINK = ( |
| 195 | 'https://boto3.amazonaws.com/' |
| 196 | 'v1/documentation/api/latest/guide/error-handling.html' |
| 197 | ) |
| 198 | _GENERIC_ERROR_SHAPE = DocumentedShape( |
| 199 | name='Error', |
| 200 | type_name='structure', |
| 201 | documentation=('Normalized access to common exception attributes.'), |
| 202 | members=OrderedDict( |
| 203 | [ |
| 204 | ( |
| 205 | 'Code', |
| 206 | DocumentedShape( |
| 207 | name='Code', |
| 208 | type_name='string', |
| 209 | documentation=( |
| 210 | 'An identifier specifying the exception type.' |
| 211 | ), |
| 212 | ), |
| 213 | ), |
| 214 | ( |
| 215 | 'Message', |
| 216 | DocumentedShape( |
| 217 | name='Message', |
| 218 | type_name='string', |
| 219 | documentation=( |
| 220 | 'A descriptive message explaining why the exception ' |
| 221 | 'occured.' |
| 222 | ), |
| 223 | ), |
| 224 | ), |
| 225 | ] |
| 226 | ), |
| 227 | ) |
| 228 | |
| 229 | def __init__(self, client, root_docs_path): |
| 230 | self._client = client |
| 231 | self._client_class_name = self._client.__class__.__name__ |
| 232 | self._service_name = self._client.meta.service_model.service_name |
| 233 | self._service_id = self._client.meta.service_model.service_id |
| 234 | self._root_docs_path = root_docs_path |
| 235 | |
| 236 | def document_exceptions(self, section): |
| 237 | self._add_title(section) |
| 238 | self._add_overview(section) |
| 239 | self._add_exceptions_list(section) |
| 240 | self._add_exception_classes() |
| 241 | |
| 242 | def _add_title(self, section): |
| 243 | section.style.h2('Client Exceptions') |
| 244 | |
| 245 | def _add_overview(self, section): |
| 246 | section.style.new_line() |
| 247 | section.write( |
| 248 | 'Client exceptions are available on a client instance ' |
| 249 | 'via the ``exceptions`` property. For more detailed instructions ' |
| 250 | 'and examples on the exact usage of client exceptions, see the ' |