Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests: napi_get_last_error_info #19190

Closed
wants to merge 3 commits into from

Conversation

bartlomieju
Copy link
Member

No description provided.

@bartlomieju bartlomieju marked this pull request as ready for review April 20, 2024 22:00
Comment on lines +1892 to +1912
"Invalid argument",
"An object was expected",
"A string was expected",
"A string or symbol was expected",
"A function was expected",
"A number was expected",
"A boolean was expected",
"An array was expected",
"Unknown failure",
"An exception is pending",
"The async work item was cancelled",
"napi_escape_handle already called on scope",
"Invalid handle scope usage",
"Invalid callback scope usage",
"Thread-safe function queue is full",
"Thread-safe function handle is closing",
"A bigint was expected",
"A date was expected",
"An arraybuffer was expected",
"A detachable arraybuffer was expected",
"Main thread would deadlock",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should these be cstrings? (NUL terminated)

Comment on lines -1897 to +1942
error_message: std::ptr::null(),
engine_reserved: std::ptr::null_mut(),
engine_error_code: 0,
error_code: napi_ok,
error_message: env.last_error.error_message,
engine_reserved: env.last_error.engine_reserved,
engine_error_code: env.last_error.engine_error_code,
error_code: env.last_error.error_code,
});

*error_code = Box::into_raw(err_info);
*result = Box::into_raw(err_info);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a change in this PR but I think this leaks memory. There should be a static napi_extended_error_info that can be reused.

@bartlomieju
Copy link
Member Author

Already done in #24101

@bartlomieju bartlomieju deleted the napi_get_last_error branch July 18, 2024 02:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants