|
48 | 48 | } while (0) |
49 | 49 |
|
50 | 50 | // Returns nullptr if the_call doesn't return JSVM_OK. |
51 | | -#define NODE_API_CALL(status, env, the_call) \ |
52 | | - status = the_call; \ |
53 | | - if (status != JSVM_OK) { \ |
54 | | - bool isPending = false; \ |
55 | | - if (JSVM_OK == OH_JSVM_IsExceptionPending((env), &isPending) && isPending) { \ |
56 | | - JSVM_Value error; \ |
57 | | - if (JSVM_OK == OH_JSVM_GetAndClearLastException((env), &error)) { \ |
58 | | - JSVM_Value stack; \ |
59 | | - OH_JSVM_GetNamedProperty((env), error, "stack", &stack); \ |
60 | | - JSVM_Value message; \ |
61 | | - OH_JSVM_GetNamedProperty((env), error, "message", &message); \ |
62 | | - char stackstr[256]; \ |
63 | | - OH_JSVM_GetValueStringUtf8(env, stack, stackstr, 256, nullptr); \ |
64 | | - SE_LOGE("JSVM error stack: %{public}s", stackstr); \ |
65 | | - char messagestr[256]; \ |
66 | | - OH_JSVM_GetValueStringUtf8(env, message, messagestr, 256, nullptr); \ |
67 | | - SE_LOGE("JSVM error message: %{public}s", messagestr); \ |
68 | | - } \ |
69 | | - } \ |
70 | | - } \ |
| 51 | +#define NODE_API_CALL(status, env, the_call) \ |
| 52 | + status = the_call; \ |
| 53 | + if (status != JSVM_OK) { \ |
| 54 | + bool isPending = false; \ |
| 55 | + if (JSVM_OK == OH_JSVM_IsExceptionPending((env), &isPending) && isPending) { \ |
| 56 | + JSVM_Value error; \ |
| 57 | + if (JSVM_OK == OH_JSVM_GetAndClearLastException((env), &error)) { \ |
| 58 | + JSVM_Value stack; \ |
| 59 | + OH_JSVM_GetNamedProperty((env), error, "stack", &stack); \ |
| 60 | + JSVM_Value message; \ |
| 61 | + OH_JSVM_GetNamedProperty((env), error, "message", &message); \ |
| 62 | + char stackstr[256]; \ |
| 63 | + OH_JSVM_GetValueStringUtf8(env, stack, stackstr, 256, nullptr); \ |
| 64 | + SE_LOGE("JSVM error stack: %s", stackstr); \ |
| 65 | + char messagestr[256]; \ |
| 66 | + OH_JSVM_GetValueStringUtf8(env, message, messagestr, 256, nullptr); \ |
| 67 | + SE_LOGE("JSVM error message: %s", messagestr); \ |
| 68 | + } \ |
| 69 | + } \ |
| 70 | + } \ |
71 | 71 | NODE_API_CALL_BASE(env, status, nullptr) |
72 | 72 |
|
73 | 73 | // Returns empty if the_call doesn't return JSVM_OK. |
|
0 commit comments