Skip to content

Commit

Permalink
[Internal] Init FlowRequestException with _inner_exception. (#2667)
Browse files Browse the repository at this point in the history
# Description

In this PR, we init FlowRequestException with _inner_exception by param
error.
And then, we can use e.inner_exception for error handling.


![image](https://github.com/microsoft/promptflow/assets/2418764/b60b19e5-6950-4136-afa7-4f709cfa7119)


# All Promptflow Contribution checklist:
- [ ] **The pull request does not introduce [breaking changes].**
- [ ] **CHANGELOG is updated for new features, bug fixes or other
significant changes.**
- [ ] **I have read the [contribution guidelines](../CONTRIBUTING.md).**
- [ ] **Create an issue and link to the pull request to get dedicated
review from promptflow team. Learn more: [suggested
workflow](../CONTRIBUTING.md#suggested-workflow).**

## General Guidelines and Best Practices
- [ ] Title of the pull request is clear and informative.
- [ ] There are a small number of commits, each of which have an
informative message. This means that previously merged commits do not
appear in the history of the PR. For more information on cleaning up the
commits in your PR, [see this
page](https://github.com/Azure/azure-powershell/blob/master/documentation/development-docs/cleaning-up-commits.md).

### Testing Guidelines
- [ ] Pull request includes test coverage for the included changes.

---------

Co-authored-by: Yangtong Xu <[email protected]>
  • Loading branch information
riddlexu and Yangtong Xu authored Apr 7, 2024
1 parent 19a54f0 commit 5dcddc5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ def wrapper(self, *args, **kwargs):
f"Status code: {e.status_code} \n"
f"Reason: {e.reason} \n"
f"Error message: {e.message} \n",
privacy_info=[e.reason, e.message]
privacy_info=[e.reason, e.message],
error=e,
)

return wrapper
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -903,6 +903,11 @@ def check_inner_call(*args, **kwargs):
# request id should be included in FlowRequestException
assert f"request id: {pf.runs._service_caller._request_id}" in str(e.value)

inner_exception = e.value.inner_exception
assert inner_exception is not None
assert isinstance(inner_exception, HttpResponseError)
assert inner_exception.message == "customized error message."

# it is a known issue that executor/runtime might write duplicate storage for line records,
# this will lead to the lines that assert line count (`len(detail)`) fails.
@pytest.mark.xfail(reason="BUG 2819328: Duplicate line in flow artifacts jsonl", run=True, strict=False)
Expand Down

0 comments on commit 5dcddc5

Please sign in to comment.