try catch

    try {
        // 错误信息会被 error 捕获
    } catch (error) {
        // 会在这里显示
    }

throw Error 抛出错误
Error 也是一个对象
catch /kætʃ/ 捕获
try /traɪ/ 尝试,努力
throw /θrəʊ/
props /prɒps/ 属性

你可能感兴趣的:(try catch)