Skip to content

Unify ParamValidationError translation and document S3 error codes #1374

Open

Description

@laughingman7743

Part of #1342 (item 3).

Decision

  1. ParamValidationError: S3Core.call raises ValueError for every operation, from the botocore error.
  2. S3 error code: S3ClientError.code_of(error) is documented as the public way to get the S3 error code of a translated error. No attribute is added to the OSError.
  3. exists() on 403: unchanged (True for a bucket, PermissionError for a key). It is documented, because a 403 for a key does not tell whether the key exists.
  4. copy_object_annotation: closes the payload and translates the read errors.

Current state (29cc1d3, offline)

  1. cat_file and pipe_file raise the raw botocore ParamValidationError; only mkdir converts it (s3.py:1387).
  2. Callers use S3ClientError.code_of (s3_errors.py:139) internally; it is not documented.
  3. exists(): s3.py:1108.
  4. s3_core.py:1461 reads the payload without closing it, and a read failure surfaces untranslated.

Deferred: core options missing_ok for aborts and an InvalidRange mode for get_object.

Compatibility

ParamValidationError → ValueError is breaking (release note).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions