-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🐛 Source Amplitude: add error descriptions and fix
events
stream fa…
…il on 404 (#12430)
- Loading branch information
Showing
7 changed files
with
102 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
airbyte-integrations/connectors/source-amplitude/source_amplitude/errors.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# | ||
# Copyright (c) 2021 Airbyte, Inc., all rights reserved. | ||
# | ||
|
||
import logging | ||
|
||
LOGGER = logging.getLogger("airbyte") | ||
|
||
HTTP_ERROR_CODES = { | ||
400: { | ||
"msg": "The file size of the exported data is too large. Shorten the time ranges and try again. The limit size is 4GB.", | ||
"lvl": "ERROR", | ||
}, | ||
404: { | ||
"msg": "No data collected", | ||
"lvl": "WARN", | ||
}, | ||
504: { | ||
"msg": "The amount of data is large causing a timeout. For large amounts of data, the Amazon S3 destination is recommended.", | ||
"lvl": "ERROR", | ||
}, | ||
} | ||
|
||
|
||
def error_msg_from_status(status: int = None): | ||
if status: | ||
level = HTTP_ERROR_CODES[status]["lvl"] | ||
message = HTTP_ERROR_CODES[status]["msg"] | ||
if level == "ERROR": | ||
LOGGER.error(message) | ||
elif level == "WARN": | ||
LOGGER.warn(message) | ||
else: | ||
LOGGER.error(f"Unknown error occured: code {status}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters