// Warning-level patterns (external issues or AI mistakes)
const WARNING_PATTERNS = [
    // Database schema errors (AI made a schema mistake)
    /column.*not found/i,
    /column.*does not exist/i,
    /unknown column/i,
    /no such column/i,
    /table.*not found/i,
    /table.*does not exist/i,
    /relation.*does not exist/i,
    /invalid.*column/i,
    /field.*not found/i,
    /undefined column/i,
    // External API 4xx client errors
    /400.*bad request/i,
    /404.*not found/i,
    /405.*method not allowed/i,
    /422.*unprocessable/i,
    /429.*rate limit/i,
];
/**
 * Classify an external API error and return appropriate severity.
 *
 * - WARN: External API 4xx errors, database schema errors - external issues or AI mistakes
 * - ERROR: Connection errors, auth errors, permission errors - actual problems
 */
export function classifyExternalErrorSeverity(errorMessage) {
    // External issues or AI mistakes → WARN
    if (WARNING_PATTERNS.some((p) => p.test(errorMessage))) {
        return "warn";
    }
    // Everything else (connection, auth, permission errors) → ERROR
    return "error";
}
//# sourceMappingURL=errors.js.map