Skip to content

Commit 2c60d55

Browse files
committed
fix: Add missing object id reference to the thrown Validator errors
1 parent cfbaf00 commit 2c60d55

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

src/resolver/TimelineValidator.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ export class TimelineValidator {
8686
if (err instanceof Error) {
8787
const err2 = new Error(`Object "${obj.id}": ${err.message}`)
8888
err2.stack = err.stack
89-
throw err
89+
throw err2
9090
} else throw err
9191
}
9292
}

src/resolver/__tests__/TimelineValidator.spec.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,21 @@ test('validateReferenceString', () => {
5454
/contains characters which aren't allowed in Timeline: "-" \(is an operator\), "§", "=" \(is a strict reserved character/
5555
)
5656
})
57+
test('validateObject', () => {
58+
const validator = new TimelineValidator()
59+
expect(() =>
60+
validator.validateObject(
61+
{
62+
id: 'obj0',
63+
content: {},
64+
enable: {
65+
start: 0,
66+
duration: 0,
67+
end: 0, // end and duration cannot be combined
68+
},
69+
layer: 'L1',
70+
},
71+
true
72+
)
73+
).toThrow(/obj0.*end.*duration.*cannot be combined/)
74+
})

0 commit comments

Comments
 (0)