Skip to content

Commit 088865e

Browse files
committed
fix: improve error message for invalid type in data
1 parent 2cd72e0 commit 088865e

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

rita-core/src/logicElements/Atom.ts

+7-2
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,17 @@ export class Atom extends Formula {
5656
const a = path.split('.');
5757
for (let i = 0, n = a.length; i < n; ++i) {
5858
const k = a[i];
59-
if (typeof object === 'undefined') {
59+
if (typeof object !== 'object') {
6060
if (defaultVal !== undefined) {
6161
return defaultVal;
6262
} else {
6363
throw new UndefinedPathError(
64-
'Undefinded path in data: ' + path,
64+
'Invalid path in data: ' +
65+
path +
66+
' is of invalid type ' +
67+
typeof object +
68+
' with value ' +
69+
object,
6570
context
6671
);
6772
}

0 commit comments

Comments
 (0)