UNPKG

appium-xcuitest-driver

Version:

Appium driver for iOS using XCUITest for backend

26 lines 877 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.TimeoutError = void 0; exports.withTimeout = withTimeout; const asyncbox_1 = require("asyncbox"); /** Error thrown by {@link withTimeout} when the deadline is exceeded. */ class TimeoutError extends Error { constructor(message) { super(message ?? 'Operation timed out'); this.name = 'TimeoutError'; } } exports.TimeoutError = TimeoutError; /** Resolves with `promise` or rejects if it does not settle before `timeoutMs`. */ async function withTimeout(promise, timeoutMs, message) { try { return await (0, asyncbox_1.withTimeout)(promise, timeoutMs, message); } catch (err) { if (err instanceof asyncbox_1.TimeoutError) { throw new TimeoutError(err.message); } throw err; } } //# sourceMappingURL=async.js.map