Closed multiplehats closed 5 months ago
No response
The error code types are not exported in the sdk:
"NOT_FOUND" | "FORBIDDEN" | "USAGE_EXCEEDED" | "RATE_LIMITED" | "UNAUTHORIZED" | "DISABLED" | "INSUFFICIENT_PERMISSIONS" | undefined;.
"NOT_FOUND" | "FORBIDDEN" | "USAGE_EXCEEDED" | "RATE_LIMITED" | "UNAUTHORIZED" | "DISABLED" | "INSUFFICIENT_PERMISSIONS" | undefined;
I manually copied them because I'm trying to remap them to the http-status pkg.
http-status
import httpStatus from 'http-status'; type UnkeyResponses = | 'NOT_FOUND' | 'FORBIDDEN' | 'USAGE_EXCEEDED' | 'RATE_LIMITED' | 'UNAUTHORIZED' | 'DISABLED' | 'INSUFFICIENT_PERMISSIONS' | undefined; const getHttpErrCodeFromUnkeyErr = (error: UnkeyResponses) => { switch (error) { case 'NOT_FOUND': return httpStatus.NOT_FOUND; case 'FORBIDDEN': return httpStatus.FORBIDDEN; case 'USAGE_EXCEEDED': return httpStatus.TOO_MANY_REQUESTS; case 'RATE_LIMITED': return httpStatus.TOO_MANY_REQUESTS; case 'UNAUTHORIZED': return httpStatus.UNAUTHORIZED; case 'DISABLED': return httpStatus.FORBIDDEN; case 'INSUFFICIENT_PERMISSIONS': return httpStatus.FORBIDDEN; default: return httpStatus.INTERNAL_SERVER_ERROR; } };
Ability to import it
- OS: - Node: - npm:
ENG-632 The error code types are not exported
i can take this
fixed and released today
Preliminary Checks
Reproduction / Replay Link (Optional)
No response
Issue Summary
The error code types are not exported in the sdk:
"NOT_FOUND" | "FORBIDDEN" | "USAGE_EXCEEDED" | "RATE_LIMITED" | "UNAUTHORIZED" | "DISABLED" | "INSUFFICIENT_PERMISSIONS" | undefined;
.I manually copied them because I'm trying to remap them to the
http-status
pkg.Steps to Reproduce
Expected behavior
Ability to import it
Other information
No response
Screenshots
No response
Version info