throwProxyError creates and returns a JavaScript error.
(ctx *C.JSContext, err proxyError)
| 31 | |
| 32 | // throwProxyError creates and returns a JavaScript error. |
| 33 | func throwProxyError(ctx *C.JSContext, err proxyError) C.JSValue { |
| 34 | msg := C.CString(err.message) |
| 35 | defer C.free(unsafe.Pointer(msg)) |
| 36 | |
| 37 | switch err.errorType { |
| 38 | case "TypeError": |
| 39 | return C.ThrowTypeError(ctx, msg) |
| 40 | default: |
| 41 | return C.ThrowInternalError(ctx, msg) |
| 42 | } |
| 43 | } |
| 44 | |
| 45 | // throwModuleError creates and throws a module initialization error. |
| 46 | func throwModuleError(ctx *C.JSContext, err error) C.int { |
no test coverage detected