@solid-data-modules/chats-ldo
Version:
A library to mangage chats in Solid Pods built with LDO
22 lines • 664 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.throwIfErr = throwIfErr;
exports.throwIfErrOrAbsent = throwIfErrOrAbsent;
exports.getResource = getResource;
function throwIfErr(result) {
if (result.isError)
throw result;
return result;
}
function throwIfErrOrAbsent(result) {
const toReturn = throwIfErr(result);
if (result.type === "absentReadSuccess") {
throw new Error(`Resource ${result.resource.uri} is absent.`);
}
return toReturn;
}
function getResource(result) {
const nonErrors = throwIfErr(result);
return nonErrors.resource;
}
//# sourceMappingURL=resultHelpers.js.map