// This message is referenced in LocalRuntimeJSEngine.kt.
/**
 * @deprecated use @devvit/shared-types/CircuitBreaker.ts
 */
export const CIRCUIT_BREAKER_MSG = 'ServerCallRequired';
// to-do: use TypeScript to reference this function in SandboxedRuntimeLite.
/**
 * @arg method API method called for debugging. Eg, UserDataByAccountIds.
 * @deprecated use @devvit/shared-types/CircuitBreaker.ts
 * */
export function CircuitBreak(method) {
    // Warning: this function is serialized by SandboxRuntimeLite. Don't use
    // import dependencies.
    // Error must be postable.
    const err = Error('ServerCallRequired');
    err.cause = { method, stack: err.stack };
    return err;
}
/**
 * @deprecated use @devvit/shared-types/CircuitBreaker.ts
 */
export class CircuitBreakerResponse extends Error {
    constructor(response, cause) {
        super(CIRCUIT_BREAKER_MSG);
        this.response = response;
        this.cause = cause;
        this.name = 'CircuitBreakerResponse';
    }
}
/**
 * @deprecated use @devvit/shared-types/CircuitBreaker.ts
 */
export function isCircuitBreaker(err) {
    return err?.message === CIRCUIT_BREAKER_MSG;
}
