-
Notifications
You must be signed in to change notification settings - Fork 0
fix: trigger errors ctor #34
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
Merged
Merged
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -28,3 +28,5 @@ wheels/ | |
|
|
||
| .cache/* | ||
| .cache | ||
|
|
||
| .claude | ||
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
Empty file.
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| """Tests for UiPath trigger error classes.""" | ||
|
|
||
| from uipath.core.errors import ( | ||
| ErrorCategory, | ||
| UiPathFaultedTriggerError, | ||
| UiPathPendingTriggerError, | ||
| ) | ||
|
|
||
|
|
||
| class TestUiPathFaultedTriggerError: | ||
| """Test UiPathFaultedTriggerError constructor and behavior.""" | ||
|
|
||
| def test_init_with_detail(self) -> None: | ||
| """Test that category, message, and detail are stored and str includes both.""" | ||
| err = UiPathFaultedTriggerError( | ||
| category=ErrorCategory.USER, | ||
| message="Something failed", | ||
| detail="missing input", | ||
| ) | ||
| assert err.category == ErrorCategory.USER | ||
| assert err.message == "Something failed" | ||
| assert err.detail == "missing input" | ||
| assert str(err) == "Something failed: missing input" | ||
|
|
||
| def test_init_without_detail(self) -> None: | ||
| """Test that detail defaults to empty string and str is just the message.""" | ||
| err = UiPathFaultedTriggerError( | ||
| category=ErrorCategory.SYSTEM, | ||
| message="Internal error", | ||
| ) | ||
| assert err.category == ErrorCategory.SYSTEM | ||
| assert err.message == "Internal error" | ||
| assert err.detail == "" | ||
| assert str(err) == "Internal error" | ||
|
|
||
| def test_is_exception(self) -> None: | ||
| """Test that the error can be raised and caught as an Exception.""" | ||
| with __import__("pytest").raises(UiPathFaultedTriggerError, match="boom"): | ||
| raise UiPathFaultedTriggerError( | ||
| category=ErrorCategory.DEPLOYMENT, | ||
| message="boom", | ||
| ) | ||
|
|
||
|
|
||
| class TestUiPathPendingTriggerError: | ||
| """Test UiPathPendingTriggerError inherits correctly.""" | ||
|
|
||
| def test_inherits_faulted_trigger_error(self) -> None: | ||
| """Test that PendingTriggerError is a subclass of FaultedTriggerError.""" | ||
| err = UiPathPendingTriggerError( | ||
| category=ErrorCategory.UNKNOWN, | ||
| message="Pending", | ||
| detail="waiting for response", | ||
| ) | ||
| assert isinstance(err, UiPathFaultedTriggerError) | ||
| assert err.category == ErrorCategory.UNKNOWN | ||
| assert str(err) == "Pending: waiting for response" | ||
|
|
||
| def test_catchable_as_faulted(self) -> None: | ||
| """Test that PendingTriggerError can be caught as FaultedTriggerError.""" | ||
| with __import__("pytest").raises(UiPathFaultedTriggerError): | ||
| raise UiPathPendingTriggerError( | ||
| category=ErrorCategory.USER, | ||
| message="still pending", | ||
| ) |
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.
Uh oh!
There was an error while loading. Please reload this page.