[js][internals] updated nativeToJSError util to exclude itself from error stacks

This commit is contained in:
Salakar 2017-08-19 05:18:34 +01:00
parent 6a8656f428
commit 92504580e5
1 changed files with 3 additions and 0 deletions

View File

@ -305,6 +305,9 @@ export function nativeToJSError(code: string, message: string, additionalProps?:
const error = new Error(message);
error.code = code;
Object.assign(error, additionalProps);
// exclude this function from the stack
const _stackArray = error.stack.split('\n');
error.stack = _stackArray.splice(1, _stackArray.length).join('\n');
return error;
}