Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Migrate from NAN -> NAPI #281

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

Draft
cowboyd wants to merge 14 commits into confluentinc:master
base: master
Choose a base branch
Loading
from cowboyd:master
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
14 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
producer: NAN -> N-API
  • Loading branch information
cowboyd committed Mar 26, 2025
commit bba76c9c2173c60597dd591e9d20c13df7a9dbaa
6 changes: 6 additions & 0 deletions src/errors.cc
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ Napi::Error RdKafkaError(
return ret;
}

Napi::Value ThrowError(const Napi::Env& env, const std::string &message) {
Napi::Error error = Napi::Error::New(env, message);
error.ThrowAsJavaScriptException();
return error.Value();
}

Baton::Baton(const RdKafka::ErrorCode &code) {
m_err = code;
}
Expand Down
7 changes: 4 additions & 3 deletions src/errors.h
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,10 @@ class Baton {

Napi::Error RdKafkaError(const Napi::Env &env, const RdKafka::ErrorCode &);
Napi::Error RdKafkaError(const Napi::Env &env, const RdKafka::ErrorCode &, const std::string &);
Napi::Error RdKafkaError(const Napi::Env &env, const RdKafka::ErrorCode &err, std::string errstr,
bool isFatal, bool isRetriable,
bool isTxnRequiresAbort);
Napi::Error RdKafkaError(const Napi::Env &env, const RdKafka::ErrorCode &err,
std::string errstr, bool isFatal, bool isRetriable,
bool isTxnRequiresAbort);
Napi::Value ThrowError(const Napi::Env &env, const std::string &);

} // namespace NodeKafka

Expand Down
Loading

AltStyle によって変換されたページ (->オリジナル) /