SOURCE

function throwErr() {
    console.warn('running func throwErr, will throw an error')
    throw new Error('FUNC ERROR')
}

function caller() {
    try {
        throwErr()
    } catch (e) {
        console.warn(`caller catched an error::${e.message}, and will rethrow a new error`)
        throw new Error('new error from caller')
    }

    console.info('this line should be print as error from throwErr func has been catched.')
}

(function () {
    caller()
    console.info('this line should be print since there should be no errors which will break the runtime.')
})()
console 命令行工具 X clear

                    
>
console