-
Notifications
You must be signed in to change notification settings - Fork 43
chore: sanitize connector builder error messages #771
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
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prevent UnboundLocalError when
stream_nameis unavailable.Lines 124-128 assume
stream_namewas set earlier, but if the exception fires before that assignment (e.g., the catalog has zero streams orrun_test_readraises during evaluation of the name) the except block will hit anUnboundLocalError, masking the real failure instead of emitting the sanitized trace. Could we stash the name ahead of the try/except and fall back to a sentinel when it's missing so the handler still returns a useful error message, wdyt?def read_stream( source: ConcurrentDeclarativeSource, config: Mapping[str, Any], configured_catalog: ConfiguredAirbyteCatalog, state: List[AirbyteStateMessage], limits: TestLimits, ) -> AirbyteMessage: - try: + stream_name: str | None = None + try: test_read_handler = TestReader( limits.max_pages_per_slice, limits.max_slices, limits.max_records ) # The connector builder only supports a single stream stream_name = configured_catalog.streams[0].stream.name @@ - except Exception as exc: + except Exception as exc: + safe_stream_name = stream_name or "<unknown stream>" # - message: user-friendly error for display # - internal_message: technical details for debugging (including config/catalog) error = AirbyteTracedException.from_exception( exc, - message=filter_secrets(f"Error reading stream {stream_name}: {str(exc)}"), + message=filter_secrets(f"Error reading stream {safe_stream_name}: {str(exc)}"), ) # Override internal_message to include context for debugging error.internal_message = filter_secrets( - f"Error reading stream {stream_name} with config={config} and catalog={configured_catalog}: {str(exc)}" + f"Error reading stream {safe_stream_name} with config={config} and catalog={configured_catalog}: {str(exc)}" ) return error.as_airbyte_message()📝 Committable suggestion
🤖 Prompt for AI Agents