| 175 | #endif // NAPI_VERSION > 8 |
| 176 | |
| 177 | Value CatchError(const CallbackInfo& info) { |
| 178 | Function thrower = info[0].As<Function>(); |
| 179 | try { |
| 180 | thrower({}); |
| 181 | } catch (const Error& e) { |
| 182 | return e.Value(); |
| 183 | } |
| 184 | return info.Env().Null(); |
| 185 | } |
| 186 | |
| 187 | Value CatchErrorMessage(const CallbackInfo& info) { |
| 188 | Function thrower = info[0].As<Function>(); |