jvail/spl.js

Error does not propagates in JavaScript

spaciandd opened this issue · 3 comments

Hi @jvail , catch block is not working, I can see error in console but it does not propagates to catch callback, same is the case if I use try catch block.
https://codepen.io/spaciandd/pen/QWavjwv

import SPL from 'spl.js';

async function run() {
    const db = await SPL().then(spl => spl.db());

    console.assert(await db.exec('select spatialite_version()').get.first === '5.0.1');

    db.exec('select r as hello', ['spatialite']).get.objs
        .then(res => {
            console.log('ujsakhdsa')
        }
        )
        .catch(err => {
            console.log("err.message")
        }
        );
}
run()
jvail commented

Hi @spaciandd, thank you for reporting!
I found the bug in the worker but it seems there is also a bug in the Promise handling. I'll need a few days to figure out what's wrong and apply a proper fix.

jvail commented

@spaciandd I hope this is fixed now. Please give it a try.

@jvail all is well. thank you.