Skip to content

Commit

Permalink
🔄 synced local 'skyvern/' with remote 'skyvern/'
Browse files Browse the repository at this point in the history
<!-- ELLIPSIS_HIDDEN -->

> [!IMPORTANT]
> Improve error handling by updating unexpected exception messages to include detailed information in `agent.py`, `block.py`, and `service.py`.
>
>   - **Error Handling**:
>     - Update error message for unexpected exceptions in `execute_step()` in `agent.py` to include exception details.
>     - Change error message for unexpected exceptions in `execute_safe()` in `block.py` to include exception details.
>     - Modify error message for unexpected exceptions in `execute_workflow()` in `service.py` to include exception details.
>   - **Exception Import**:
>     - Add `SkyvernException` import to `context_manager.py` for consistent exception handling.
>
> <sup>This description was created by </sup>[<img alt="Ellipsis" src="https://img.shields.io/badge/Ellipsis-blue?color=175173">](https://www.ellipsis.dev?ref=Skyvern-AI%2Fskyvern-cloud&utm_source=github&utm_medium=referral)<sup> for 74080572cd3d29aa19fe3e8acb2dd5edbc509895. It will automatically update as commits are pushed.</sup>

<!-- ELLIPSIS_HIDDEN -->
  • Loading branch information
wintonzheng committed Jan 9, 2025
1 parent 5ca2c45 commit 82d0832
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion skyvern/forge/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,7 @@ async def execute_step(
step_id=step.step_id,
)

failure_reason = "unexpected exception"
failure_reason = f"Unexpected error: {str(e)}"
if isinstance(e, SkyvernException):
failure_reason = f"unexpected SkyvernException({e.__class__.__name__}): {str(e)}"

Expand Down
7 changes: 5 additions & 2 deletions skyvern/forge/sdk/workflow/context_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import structlog

from skyvern.exceptions import BitwardenBaseError, WorkflowRunContextNotInitialized
from skyvern.exceptions import BitwardenBaseError, SkyvernException, WorkflowRunContextNotInitialized
from skyvern.forge.sdk.api.aws import AsyncAWSClient
from skyvern.forge.sdk.schemas.organizations import Organization
from skyvern.forge.sdk.schemas.tasks import TaskStatus
Expand Down Expand Up @@ -168,9 +168,12 @@ async def register_parameter_value(

if self.has_parameter(parameter.url_parameter_key) and self.has_value(parameter.url_parameter_key):
url = self.values[parameter.url_parameter_key]
elif parameter.url_parameter_key:
# If a key can't be found within the parameter values dict, assume it's a URL (and not a URL Parameter)
url = parameter.url_parameter_key
else:
LOG.error(f"URL parameter {parameter.url_parameter_key} not found or has no value")
raise ValueError("URL parameter for Bitwarden login credentials not found or has no value")
raise SkyvernException("URL parameter for Bitwarden login credentials not found or has no value")

collection_id = None
if parameter.bitwarden_collection_id:
Expand Down
2 changes: 1 addition & 1 deletion skyvern/forge/sdk/workflow/models/block.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ async def execute_safe(
if not workflow_run_context.has_value(self.output_parameter.key):
await self.record_output_parameter_value(workflow_run_context, workflow_run_id)

failure_reason = "unexpected exception"
failure_reason = f"Unexpected error: {str(e)}"
if isinstance(e, SkyvernException):
failure_reason = f"unexpected SkyvernException({e.__class__.__name__}): {str(e)}"

Expand Down
2 changes: 1 addition & 1 deletion skyvern/forge/sdk/workflow/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ async def execute_workflow(
block_label=block.label,
)

exception_message = "unexpected exception"
exception_message = f"Unexpected error: {str(e)}"
if isinstance(e, SkyvernException):
exception_message = f"unexpected SkyvernException({e.__class__.__name__}): {str(e)}"

Expand Down

0 comments on commit 82d0832

Please sign in to comment.