You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
in my case, we try to return custom error code like apart from status code for application logics
newApiError("CONFLICT",{code: "TENANTS_NOT_AVAILABLE",// won't workerr_code: "TENANTS_NOT_AVAILABLE"// message could be even longermessage: "Tenants are not available under your current plan. Please upgrade to access tenant features."})
currently, the message is as is formatted as code, though we are adding custom keys for that, but having message formatted as code is still confusing and long
For example,
{
"err_code": "TENANTS_NOT_AVAILABLE",
"message": "Tenants are not available under your current plan. Please upgrade to access tenant features.",
"code": "TENANTS_ARE_NOT_AVAILABLE_UNDER_YOUR_CURRENT_PLAN_PLEASE_UPGRADE_TO_ACCESS_TENANT_FEATURES"
}
Allowing code to be overridden will help avoid having extra keys and also avoid having messages like this
Shouldn't APIError return a response with the correct error code?
https://github.com/Bekacru/better-call/blob/main/src/error.ts
Instead it either returns a plain status string or message if it exists.
The text was updated successfully, but these errors were encountered: