Skip to content

Add a ProxyRequestException.ParseCustomErrorResult() method#375

Open
mlaily wants to merge 1 commit intoZaid-Ajaj:masterfrom
mlaily:client-side-errors-helper
Open

Add a ProxyRequestException.ParseCustomErrorResult() method#375
mlaily wants to merge 1 commit intoZaid-Ajaj:masterfrom
mlaily:client-side-errors-helper

Conversation

@mlaily
Copy link
Copy Markdown

@mlaily mlaily commented Mar 23, 2025

Hello,

I was a bit surprised by the lack of built-int support for handling Propagated custom errors/exceptions.

It wouldn't be so bad if the propagated serialized object was the one given by the user on the server side, but it's instead wrapped inside a custom CustomErrorResult<'a> type defined on the server side, and inaccessible from the client without redefining a type with the same shape.

This makes handling exceptions on the client side harder than it has to be.

I see this topic has been discussed here #261 but not resolved.


I'd like to propose a few changes in this PR:

  • Make the CustomErrorResult<'a> type readily available on the client side.
  • Add a ParseCustomErrorResult<'userError>() method on the ProxyRequestException type.

With these changes, it should be easier to handle custom exceptions from the client side, without having to manually parse json that is not under the control of the user.

Let me know what you think!


Remark: I don't know how to run the Azure tests, so I did my best but they might be failing if I made a mistake somewhere...

So clients can more easily retrieve the serialized propagated exceptions
sent by the server.
@mlaily mlaily force-pushed the client-side-errors-helper branch from e96dd57 to 2c77f1b Compare March 23, 2025 20:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant