Ask questionsCan't find exception message text

Hi. Been working with LiquidCore for a few days. Great work!

I can't find a way to get the ACTUAL exception text during development though when an exception is thrown by a library I'm using. I explicitly catch an error with a try/catch and log the error, which looks like this ->

2019-10-18 09:26:15.348623-0500 lq[29678:105717] stdout: ### Global Catch ### { checkDecode@liquid.bundle.js:14226:22 parseKey@liquid.bundle.js:14571:44 liquid.bundle.js:14653:20 JsSignatureProvider@liquid.bundle.js:8645:85 liquid.bundle.js:8222:72 step@liquid.bundle.js:8141:23 fulfilled@liquid.bundle.js:8024:30 promiseReactionJob@[native code] [native code] Function emitAfterScript@async_hooks.js:449:14 _tickCallback@internal/process/next_tick.js:182:18 line: 14226, column: 22, sourceURL: 'liquid.bundle.js' }

That stack trace is pretty useful. But, to find the exception text I have to lookup line 14226 by generating the code on the server endpoint. Copy that text from browser to Visual Code and find the line number. I eventually find the throwing exception (although obviously I don't have the interpolated values that come with it). Here's line 14226 that throws:

    if (checksum.toString() !== newCheck.toString()) {
     (line 14226) throw new Error('Invalid checksum, ' + (checksum.toString('hex') + ' != ' + newCheck.toString('hex')));

How can I get the actual error text of "Invalid Checksum ... blah blah blah " when I log to the console? My try/catch simples catches (e) and prints the whole thing. I hope I'm just missing something very simple it would really help debugging. Thanks.

My try/catch is simply:

catch (e) {
        console.log('### Global Catch ###', e)

Answer questions ericwlange

I know this is a late reply. But if this is still relevant, you can always console.log(e.message) to get the actual human error message.


Related questions

No questions were found.
Github User Rank List