mirror of
https://github.com/oven-sh/bun
synced 2026-02-09 10:28:47 +00:00
WIP convert napi.cpp functions to set the last error
This commit is contained in:
@@ -52,6 +52,7 @@ class GlobalInternals;
|
||||
#include "headers-handwritten.h"
|
||||
#include "BunCommonStrings.h"
|
||||
#include "BunGlobalScope.h"
|
||||
#include <js_native_api_types.h>
|
||||
|
||||
namespace WebCore {
|
||||
class WorkerGlobalScope;
|
||||
@@ -587,6 +588,17 @@ public:
|
||||
|
||||
bool hasOverridenModuleResolveFilenameFunction = false;
|
||||
|
||||
// Almost all NAPI functions should set error_code to the status they're returning right before
|
||||
// they return it
|
||||
napi_extended_error_info m_lastNapiErrorInfo = {
|
||||
.error_message = "",
|
||||
// Not currently used by Bun -- always nullptr
|
||||
.engine_reserved = nullptr,
|
||||
// Not currently used by Bun -- always zero
|
||||
.engine_error_code = 0,
|
||||
.error_code = napi_ok,
|
||||
};
|
||||
|
||||
private:
|
||||
DOMGuardedObjectSet m_guardedObjects WTF_GUARDED_BY_LOCK(m_gcLock);
|
||||
WebCore::SubtleCrypto* m_subtleCrypto = nullptr;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -93,12 +93,10 @@ typedef enum {
|
||||
napi_would_deadlock // unused
|
||||
} napi_status;
|
||||
// Note: when adding a new enum value to `napi_status`, please also update
|
||||
// * `const int last_status` in the definition of `napi_get_last_error_info()'
|
||||
// in file js_native_api_v8.cc.
|
||||
// * `const char* error_messages[]` in file js_native_api_v8.cc with a brief
|
||||
// * `constexpr int last_status` in the definition of `napi_get_last_error_info()'
|
||||
// in file napi.cpp.
|
||||
// * `const char* error_messages[]` in file napi.cpp with a brief
|
||||
// message explaining the error.
|
||||
// * the definition of `napi_status` in doc/api/n-api.md to reflect the newly
|
||||
// added value(s).
|
||||
|
||||
typedef napi_value (*napi_callback)(napi_env env, napi_callback_info info);
|
||||
typedef void (*napi_finalize)(napi_env env, void *finalize_data,
|
||||
|
||||
Reference in New Issue
Block a user