Client methods should be able to return custom errors #1995
Labels
Azure.Core
The azure_core crate
Client
This issue points to a problem in the data-plane of the library.
unbranded
Issues concerning client generation that are not required for Azure services.
Currently, our Rust guidelines dictate returning an
azure_core::Result<T>
from our client methods, which is re-exported fromtypespec
which aliases this asstd::result::Result<T, typespec::error::Error>
wheretypespec::error::Error
is modeled after our REST API guidelines.For TypeSpec-emitted clients that do no return an Azure error, we should support returning custom errors even if basic i.e., just an HTTP status code.
One idea is that we do this unconditionally if emitting a client in an "unbranded" mode.
Another idea would be to just emit code that returns a
std::result::Result<T, E>
whereE
is the modeled error type IIFE
isn't modeled after an Azure error response. Note thattypespec::error::Error
does not mention "Azure" - it's a generic definition of Azure error specs.The text was updated successfully, but these errors were encountered: