Errors
In order to generate SDKs idiomatically, Fern needs to know how to differentiate between different errors when parsing an endpoint response.
Discriminate by status code
You can specify Fern to discriminate by status code. This means on each endpoint, every error that’s listed must have a different HTTP status code.
api.yml
Discriminate by error name
You can specify Fern to discriminate by error name. If you select this strategy, then Fern will assume that every error response has an extra property denoting the error name.
If you use Fern to generate server-side code, then this option provides the most flexibility. Otherwise, you’ll probably want to use the status code discrimination strategy.
api.yml
Global errors
You can import and list errors that will be thrown by every endpoint.
api.yml