2023-12-27 11:06:29 +08:00
|
|
|
// no dependencies
|
|
|
|
import {__DEBUG__} from "../PublicProperty";
|
|
|
|
|
2023-12-27 14:34:03 +08:00
|
|
|
export function noexcept(_f) {
|
2023-12-27 11:06:29 +08:00
|
|
|
/**
|
|
|
|
* No exceptions.
|
|
|
|
* @returns {*}
|
|
|
|
* @private
|
|
|
|
*/
|
|
|
|
function _wrap() {
|
|
|
|
try {
|
2023-12-27 14:34:03 +08:00
|
|
|
return _f.apply(this, arguments);
|
2023-12-27 11:06:29 +08:00
|
|
|
} catch (e) {
|
|
|
|
console.debug(e);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return _wrap;
|
|
|
|
}
|
|
|
|
|
2023-12-27 14:34:03 +08:00
|
|
|
export const sill = noexcept((_x) => {
|
2023-12-27 11:06:29 +08:00
|
|
|
if(__DEBUG__) {
|
2023-12-27 14:34:03 +08:00
|
|
|
console.log(_x);
|
2023-12-27 11:06:29 +08:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2023-12-27 14:34:03 +08:00
|
|
|
export const sill_unwrap = noexcept((_x) => {
|
|
|
|
sill(JSON.stringify(_x));
|
2023-12-27 11:06:29 +08:00
|
|
|
});
|