-
Notifications
You must be signed in to change notification settings - Fork 0
[PD1-581] Display CloudFront ID in csv_import error messages #7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| { | ||
| "hooks": { | ||
| "PostToolUse": [ | ||
| { | ||
| "matcher": "Write|Edit|MultiEdit", | ||
| "hooks": [ | ||
| { | ||
| "type": "command", | ||
| "command": "jq -r .tool_input.file_path | { read file_path; if echo \"$file_path\" | grep -qE \"\\.(py)$\"; then scripts/lint.sh \"$file_path\"; fi; }" | ||
| } | ||
| ] | ||
| } | ||
| ] | ||
| } | ||
| } |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,6 +12,7 @@ | |
| from datetime import datetime | ||
| from pathlib import Path | ||
| from typing import List, Optional | ||
| import requests | ||
|
|
||
| from cvec import CVec | ||
| from cvec.models.metric import MetricDataPoint | ||
|
|
@@ -30,6 +31,7 @@ def parse_timestamp(timestamp_str: str) -> datetime: | |
| "%Y-%m-%d", | ||
| "%m/%d/%Y %H:%M:%S", | ||
| "%m/%d/%Y", | ||
| "%m/%d/%y %H:%M", | ||
| ] | ||
|
|
||
| for fmt in formats: | ||
|
|
@@ -209,6 +211,14 @@ def main() -> None: | |
| metric_prefix=args.prefix, | ||
| ) | ||
|
|
||
| except requests.HTTPError as e: | ||
| print(f"Error: {e}") | ||
| # Display CloudFront ID if available | ||
| if e.response is not None: | ||
| cf_id = e.response.headers.get("x-amz-cf-id") | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| if cf_id: | ||
| print(f"Cf-Id: {cf_id}") | ||
| sys.exit(1) | ||
| except Exception as e: | ||
| print(f"Error: {e}") | ||
| sys.exit(1) | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -6,6 +6,14 @@ set -e | |||||
|
|
||||||
| TARGET=${1:-.} | ||||||
|
|
||||||
| poetry run ruff check --fix "$TARGET" | ||||||
| poetry run ruff format "$TARGET" | ||||||
| poetry run mypy --strict "$TARGET" | ||||||
| echo -e "poetry run ruff check --fix" "$@" | ||||||
| poetry run ruff check --fix "$@" | ||||||
|
|
||||||
| echo -e "\npoetry run ruff format" "$@" | ||||||
| poetry run ruff format "$@" | ||||||
|
|
||||||
| echo -e "\nrun mypy --strict" "$@" | ||||||
| poetry run mypy --strict "$@" | ||||||
|
|
||||||
| echo -e "\npoetry run pytest" | ||||||
| poetry run pytest | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The
Suggested change
|
||||||
Uh oh!
There was an error while loading. Please reload this page.