/** * @license * Copyright 2018 Palantir Technologies, Inc. * * 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. */ export interface IQoSMetadata { retryHint?: string; dueTo?: string; } export declare enum ConjureErrorType { Network = "NETWORK", Other = "OTHER", Parse = "PARSE", Status = "STATUS" } /** * Brands every {@link ConjureError} so {@link isConjureError} recognises errors from a *different* copy of * conjure-client (where `instanceof` fails), including ones that have crossed a Web Worker / `postMessage` * boundary. It has to be an own, enumerable, string-keyed property because that is the only shape structured * clone preserves — a symbol or prototype brand would be dropped by the clone. The price is visibility: it * necessarily surfaces in `JSON.stringify`, `Object.keys`, spread and `for...in`. The `"instanceof "` prefix * makes a branded object self-describing. */ export declare const IS_CONJURE_ERROR_KEY = "instanceof conjure-client#ConjureError"; export declare class ConjureError { readonly [IS_CONJURE_ERROR_KEY]: true; readonly type: ConjureErrorType; readonly originalError?: any; readonly status?: number; readonly body?: string | E; readonly qos?: IQoSMetadata; constructor(errorType: ConjureErrorType, originalError?: any, status?: number, body?: string | E, qos?: IQoSMetadata); toString(): string; } export declare function isConjureError(error: unknown): error is ConjureError;