askql
askql copied to clipboard
'set' resource doesn't handle type mismatch
When trying to use set
on an object, it fails with an Uncaught TypeError: arr.slice is not a function
.
We should add type validation and our own error handling.
🦄 .editor
// Entering editor mode (^D to finish, ^C to cancel)
let a = {}
a:set('a', 'value')
Uncaught TypeError: arr.slice is not a function
at Resource.<anonymous> (/Users/milimetr/Desktop/askql/askql/dist/askvm/resources/list/set.js:18:32)
at Generator.next (<anonymous>)
at /Users/milimetr/Desktop/askql/askql/dist/askvm/resources/list/set.js:8:71
at new Promise (<anonymous>)
at __awaiter (/Users/milimetr/Desktop/askql/askql/dist/askvm/resources/list/set.js:4:12)
at Resource.resolver (/Users/milimetr/Desktop/askql/askql/dist/askvm/resources/list/set.js:17:16)
🦄
a:set('a', 'value')
is set(a, 'a', 'value')
is set({}, 'a', 'value')
is {} = 'a'
so no wonder this throws. Error message should be more informative though
Blocked on https://github.com/xFAANG/askql/issues/45