UNPKG

ottoman

Version:
21 lines 1.18 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.parseError = void 0; const couchbase_1 = require("couchbase"); function parseError(e, info) { var _a; const { message, cause } = e; const response = (_a = cause === null || cause === void 0 ? void 0 : cause.response) !== null && _a !== void 0 ? _a : ''; if (response.includes('scope_not_found') || e instanceof couchbase_1.ScopeNotFoundError) { throw new couchbase_1.ScopeNotFoundError(new Error(`${message}${message.includes('drop collection') ? ` '${info.collectionName}'` : ''}, scope '${info.scopeName}' not found`)); } if (response.includes('collection_not_found') || e instanceof couchbase_1.CollectionNotFoundError) { throw new couchbase_1.CollectionNotFoundError(new Error(`${message}, in scope '${info.scopeName}' collection '${info.collectionName}' not found`)); } if (e instanceof couchbase_1.BucketNotFoundError) { throw new couchbase_1.BucketNotFoundError(new Error(`failed to drop bucket, bucket '${info.bucketName}' not found`)); } throw e; } exports.parseError = parseError; //# sourceMappingURL=parse-errors.js.map