Makelore 2.0 initial clean snapshot
This commit is contained in:
25
shared/opencode-error-kind.ts
Normal file
25
shared/opencode-error-kind.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
export type OpencodeErrorKind = 'quota_exhausted' | 'authentication_invalid';
|
||||
|
||||
export function getOpencodeErrorKind(message: string | null | undefined): OpencodeErrorKind | null {
|
||||
const normalized = message?.trim().toLowerCase() ?? '';
|
||||
if (!normalized) return null;
|
||||
if (
|
||||
normalized.includes('user quota is not enough')
|
||||
|| normalized.includes('quota is not enough')
|
||||
|| normalized.includes('quota not enough')
|
||||
|| normalized.includes('insufficient quota')
|
||||
|| normalized.includes('quota exhausted')
|
||||
|| normalized.includes('quota exceeded')
|
||||
|| normalized.includes('token_balance_exhausted')
|
||||
|| normalized.includes('token balance exhausted')
|
||||
|| normalized.includes('balance exhausted')
|
||||
|| normalized.includes('rolling 5-hour window')
|
||||
|| normalized.includes('额度不足')
|
||||
) {
|
||||
return 'quota_exhausted';
|
||||
}
|
||||
if (normalized.includes('works_square_gateway_authorize_failed')) {
|
||||
return 'authentication_invalid';
|
||||
}
|
||||
return null;
|
||||
}
|
||||
Reference in New Issue
Block a user