try { const test = 'string1' console.log(test) test = 'string2' console.log(test) } catch (e) { console.log(e.stack) }