Skip to content

Commit

Permalink
Merge pull request IntelRealSense#2151 from tingshao/reset_error
Browse files Browse the repository at this point in the history
[Node.js] Reset internal error among each native call
  • Loading branch information
tingshao authored Jul 27, 2018
2 parents 13afbea + 3dac6a5 commit 4a2dc91
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions wrappers/nodejs/src/addon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,8 @@ ErrorUtil* ErrorUtil::singleton_ = nullptr;

template<typename R, typename F, typename... arguments>
R GetNativeResult(F func, rs2_error** error, arguments... params) {
// reset the error pointer for each call.
*error = nullptr;
ErrorUtil::ResetError();
R val = func(params...);
ErrorUtil::AnalyzeError(*error);
Expand All @@ -193,6 +195,8 @@ R GetNativeResult(F func, rs2_error** error, arguments... params) {

template<typename F, typename... arguments>
void CallNativeFunc(F func, rs2_error** error, arguments... params) {
// reset the error pointer for each call.
*error = nullptr;
ErrorUtil::ResetError();
func(params...);
ErrorUtil::AnalyzeError(*error);
Expand Down

0 comments on commit 4a2dc91

Please sign in to comment.