/
niceSOFT
/
swig
Обзор
Документация
Войти
/
niceSOFT
/
swig
Код
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
Examples/javascript/exception/runme.js
64 строки
1 KB
William S Fulton
Javascript v8 object to string exceptions improvement
19 сен 2022, 11:09
19 сен 2022, 11:09
d32943b
Код
Авторство
О чём код?
var example = require("example"); console.log("Trying to catch some exceptions."); t = new example.Test(); try{ t.unknown(); throw -1; } catch(error) { if(error == -1) { console.log("t.unknown() didn't throw"); } else { console.log("successfully caught throw in Test::unknown() :" + error); } } try{ t.simple(); throw -1; } catch(error){ if(error == -1) { console.log("t.simple() did not throw"); } else { console.log("successfully caught throw in Test::simple() :" + error); } } try{ t.message(); throw -1; } catch(error){ if(error == -1) { console.log("t.message() did not throw"); } else { console.log("successfully caught throw in Test::message() :" + error); } } try{ t.hosed(); throw -1; } catch(error){ if(error == -1) { console.log("t.hosed() did not throw"); } else { console.log("successfully caught throw in Test::hosed() :" + error); } } for (var i=1; i<4; i++) { try{ t.multi(i); throw -1; } catch(error){ if(error == -1) { console.log("t.multi(" + i + ") did not throw"); } else { console.log("successfully caught throw in Test::multi() :" + error); } } }