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