From ff9a7092923e60e83bdd4b9f1b7c089bd2b5d8d7 Mon Sep 17 00:00:00 2001 From: Scarlet Rose <70824102+scarletquasar@users.noreply.github.com> Date: Sat, 16 Sep 2023 04:17:50 -0300 Subject: [PATCH] chore: added error blocker to unwrap without being sure that the value is declared --- projects/core/logic/api/modules/stdlib/functional-core.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/projects/core/logic/api/modules/stdlib/functional-core.ts b/projects/core/logic/api/modules/stdlib/functional-core.ts index 28b4a60c..c76db874 100644 --- a/projects/core/logic/api/modules/stdlib/functional-core.ts +++ b/projects/core/logic/api/modules/stdlib/functional-core.ts @@ -25,6 +25,9 @@ class Result { } unwrap() { + if (this.rightValue == null || this.rightValue == undefined) { + throw new Error("The target value is not specified correctly and the operation is unsafe."); + } return this.rightValue; }