careful-honey-27437
06/10/2025, 6:42 AMbrief-egg-61061
06/10/2025, 6:42 AMbrief-egg-61061
06/10/2025, 6:42 AMcreateIdentity
method (e.g., identityAPI.createIdentity({ createIdentityBody })
), you need to inspect the error object returned by the API client. The Ory API returns errors in a standard JSON format, which includes a status code field. For example, in the error response, you will find a field such as status_code
(for Ory Network) or code
(for Ory Kratos) within the error object: - For Ory Network, the error response includes: json { "error": { "status_code": 400, "message": "Message contains the error message.", ... } }
- For Ory Kratos, the error response includes: json { "error": { "code": 400, "message": "Error message", ... } }
So, after catching the error, you should access error.response.data.error.status_code
(Ory Network) or error.response.data.error.code
(Ory Kratos) to get the actual status code, depending on which Ory product you are using. If you are using the Go SDK, the HTTP response object (r
) also contains the status code as `r.StatusCode`[Ory API Reference - createIdentity](https://www.ory.sh/docs/reference/api). Example (JavaScript/TypeScript): js try { await identityAPI.createIdentity({ createIdentityBody }); } catch (error) { // For Ory Network const statusCode = error.response?.data?.error?.status_code; // For Ory Kratos // const statusCode = error.response?.data?.error?.code; console.log('Status code:', statusCode); }
Example (Go SDK): go createdIdentity, r, err := apiClient.IdentityApi.CreateIdentity(ctx).CreateIdentityBody(body).Execute() if err != nil { fmt.Println("Status code:", r.StatusCode) }
[Ory API Reference - createIdentity](https://www.ory.sh/docs/reference/api)careful-honey-27437
06/10/2025, 6:43 AMbrief-egg-61061
06/10/2025, 6:43 AMbrief-egg-61061
06/10/2025, 6:43 AMstatus_code
(Ory Network) or code
(Ory Kratos) inside the error
object of the response body. However, if you are only seeing an empty response
object and a name
of "ResponseError"
, this suggests that the error handling in your client or SDK is not exposing the full error response from the API. The knowledge sources do not provide details about SDK-specific error handling or what to do if the error object is empty. They only describe the expected error response format from the API side, not how the client should handle or expose it. Therefore, I cannot provide a definitive solution for your specific client-side issue based on the available documentation. If you are not receiving the expected error structure, you may need to: - Check if your HTTP client or SDK is configured to parse and expose the response body. - Inspect the raw HTTP response (e.g., using network tools or additional logging) to see if the API is returning more information that your client is not displaying. I'm sorry, but the knowledge sources do not contain enough information to explain why you are only seeing an empty response
object and how to resolve this in your client code. For further troubleshooting, you may need to consult the SDK documentation or seek support from the Ory community.careful-honey-27437
06/10/2025, 7:08 AMcareful-honey-27437
06/10/2025, 7:08 AMbrief-egg-61061
06/10/2025, 7:08 AMbrief-egg-61061
06/10/2025, 7:08 AM@ory/client-fetch
SDK. They mention the [npm package for @ory/client-fetch](https://www.npmjs.com/package/@ory/client-fetch), but do not specify a GitHub repository URL for this SDK. If you need the source code, you may want to check the [Ory SDKs GitHub repository](https://github.com/ory/sdk/tree/master/clients/client), but the exact location for @ory/client-fetch
is not explicitly stated in the provided documentation [Ory API Reference](https://www.ory.sh/docs/reference/api).