@demicodes/provider 0.4.1 → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.mjs +3 -3
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -139,9 +139,9 @@ function httpErrorCode(status, message) {
|
|
|
139
139
|
function normalizeErrorCode(code, message) {
|
|
140
140
|
const value = `${code ?? ""} ${message}`.toLowerCase();
|
|
141
141
|
if (/context|too long|max.*token/.test(value)) return "context_length_exceeded";
|
|
142
|
-
if (/rate|quota|billing|limit/.test(value)) return "rate_limit";
|
|
143
|
-
if (/auth|
|
|
144
|
-
if (/overload|unavailable|
|
|
142
|
+
if (/rate|quota|usage|billing|balance|limit/.test(value)) return "rate_limit";
|
|
143
|
+
if (/auth|invalid.*(key|token)|expired/.test(value)) return "auth_expired";
|
|
144
|
+
if (/overload|unavailable|timed?\s?out|fetch failed|network|socket|econn/.test(value)) return "overloaded";
|
|
145
145
|
return code;
|
|
146
146
|
}
|
|
147
147
|
/** Builds a provider `error` event from an unknown thrown value, redacting `secret`. */
|