Skip to content

fix: replace bare except with ClientError in glue_crawler.py#17

Open
AmSach wants to merge 1 commit into
RekhuGopal:mainfrom
AmSach:fix/glue-crawler-bare-except
Open

fix: replace bare except with ClientError in glue_crawler.py#17
AmSach wants to merge 1 commit into
RekhuGopal:mainfrom
AmSach:fix/glue-crawler-bare-except

Conversation

@AmSach

@AmSach AmSach commented Jun 20, 2026

Copy link
Copy Markdown

Hi! While browsing the repo, I noticed that AWS_Glue_Crawler_and_Data_Catalog_with_Python/glue_crawler.py uses bare except: clauses around three boto3 calls. Bare except blocks silently swallow real errors (and even KeyboardInterrupt / SystemExit), and they hide the actual AWS error message, which makes debugging Glue issues very hard for anyone copying this script as a learning reference.

Changes:

  • Import ClientError from botocore.exceptions (already a transitive dep of boto3).
  • Replace each bare except: with except ClientError as e: and print the AWS error code + message.

Before

try:
    client.create_database(...)
    print("Successfully created database")
except:
    print("error in creating database")

After

try:
    client.create_database(...)
    print("Successfully created database")
except ClientError as e:
    print(f"error in creating database: {e.response['Error']['Code']} - {e.response['Error']['Message']}")

Single-file fix, no behavior change on the success path. — Sent via @AmSach bot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant