/** * Copyright (c) 2025 Databricks Contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Classifies exceptions as terminal (unrecoverable) vs retryable. * * Terminal exceptions should be flushed immediately to telemetry, * while retryable exceptions are buffered until statement completion. * * This follows the JDBC driver pattern of smart exception flushing * to optimize telemetry export efficiency while ensuring critical * errors are reported immediately. */ export default class ExceptionClassifier { /** * Determines if an exception is terminal (non-retryable). * * Terminal exceptions indicate unrecoverable failures that should * be reported immediately, such as authentication failures, invalid * requests, or resource not found errors. * * @param error - The error to classify * @returns true if the error is terminal, false otherwise */ static isTerminal(error: Error): boolean; /** * Determines if an exception is retryable. * * Retryable exceptions indicate transient failures that may succeed * on retry, such as rate limiting, server errors, or network timeouts. * * @param error - The error to classify * @returns true if the error is retryable, false otherwise */ static isRetryable(error: Error): boolean; }