Skip to main content

(Better) boto3 errors

Python 3.11 | 3.12 | 3.13 | 3.14 | 3.15 PyPI License: MIT

Typed, statically-importable exception classes for every AWS service.

Install

pip install boto3-errors

Quick start

import boto3
from boto3_errors import patch_client
from boto3_errors.dynamodb import ConditionalCheckFailedException

client = boto3.client("dynamodb")
patch_client(client)

try:
    client.put_item(
        TableName="users",
        Item={"pk": {"S": "user#1"}, "name": {"S": "Ada"}},
        ConditionExpression="attribute_not_exists(pk)",
    )
except ConditionalCheckFailedException as e:
    print(e.message)  # "The conditional request failed"
    print(e.error_code)  # "ConditionalCheckFailedException"
    print(e.item)  # {"pk": {"S": "user#1"}, "name": {"S": "Ada"}}

The problem

Every boto3 error comes back as a ClientError. The only way to distinguish them is by parsing e.response["Error"]["Code"] — a stringly-typed dict lookup with no autocomplete, no type checking, and no IDE support. A typo in the error code string won't be caught until it crashes.

What you get

All AWS services with exception classes auto-generated from botocore's service model.

Exception hierarchy

ClientError                     # botocore base — still works
└── Boto3Error                  # boto3-errors base
    └── DynamoDBError           # per-service base
        ├── ConditionalCheckFailedException
        ├── ResourceNotFoundException
        ├── TransactionCanceledException
        └── ...

Every exception is a ClientError subclass, so existing except ClientError handlers keep working.

Built-in properties

Every Boto3Error exposes:

Property Type Source
message str Error.Message
error_code str Error.Code
http_status_code int ResponseMetadata.HTTPStatusCode
request_id str ResponseMetadata.RequestId

Service-specific properties

Some exceptions expose extra fields from the API response:

from boto3_errors.dynamodb import (
    ConditionalCheckFailedException,
    TransactionCanceledException,
)

# ConditionalCheckFailedException.item -> dict | None
# TransactionCanceledException.cancellation_reasons -> list | None

Metadata

Release files for boto3-errors 0.49.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for boto3-errors 0.49.0
File Size Uploaded Provenance Actions
boto3_errors-0.49.0.tar.gz 336.4 kB Without provenance Details for boto3_errors-0.49.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for boto3-errors 0.49.0
File Interpreter ABI Platform Actions
boto3_errors-0.49.0-py3-none-any.whl Python 3 none any Details for boto3_errors-0.49.0-py3-none-any.whl

Total release size: 921.0 kB

Release files / boto3_errors-0.49.0.tar.gz

Download URL boto3_errors-0.49.0.tar.gz
Size 336.4 kB
Tags Source
SHA-256 checksum
How to use checksums
205395ba66f73b0e3c4deda22116070dbd9a2bbf215e6a79e93e3b06c31e5350
BLAKE2b-256 checksum
How to use checksums
6056342fcf7058ef496531e7fc5f335c4abf992e86fce07a4bc6434cfe7fe23c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.6 {"installer":{"name":"uv","version":"0.13.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / boto3_errors-0.49.0-py3-none-any.whl

Download URL boto3_errors-0.49.0-py3-none-any.whl
Size 584.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
dfd9dfb5b397be3a15652da80533d92e5ae5082dac9d2d1435fc06b6a7108b86
BLAKE2b-256 checksum
How to use checksums
730b2fc236e0c9665e125c522f0f640f2940c9e45f7a8bf3b2fb4a405a47a5c4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.6 {"installer":{"name":"uv","version":"0.13.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for boto3-errors 0.49.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.49.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page