@adyen/adyen-platform-experience-web
Version:

27 lines (26 loc) • 575 B
JavaScript
import { struct as E } from "../../../utils/struct/main.js";
import { getter as o, enumerable as n } from "../../../utils/struct/property.js";
const e = Symbol("<<NO_ERR>>");
function c(r) {
/* istanbul ignore if -- @preserve */
if (r === e)
throw new TypeError("Illegal error");
}
const f = () => {
let r = e;
const s = () => {
r = e;
}, a = (t) => {
c(t), r = t;
};
return E({
error: o(() => r === e ? void 0 : r),
hasError: o(() => r !== e),
reset: n(s),
set: n(a)
});
};
export {
f as createErrorContainer,
f as default
};