mirror of
https://github.com/lovell/sharp.git
synced 2025-12-19 07:15:08 +01:00
Ensure all Error objects contain a stack prop #3653
This commit is contained in:
16
lib/is.js
16
lib/is.js
@@ -137,6 +137,19 @@ const invalidParameterError = function (name, expected, actual) {
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* Ensures an Error from C++ contains a JS stack.
|
||||
*
|
||||
* @param {Error} native - Error with message from C++.
|
||||
* @param {Error} context - Error with stack from JS.
|
||||
* @returns {Error} Error with message and stack.
|
||||
* @private
|
||||
*/
|
||||
const nativeError = function (native, context) {
|
||||
context.message = native.message;
|
||||
return context;
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
defined,
|
||||
object,
|
||||
@@ -151,5 +164,6 @@ module.exports = {
|
||||
integer,
|
||||
inRange,
|
||||
inArray,
|
||||
invalidParameterError
|
||||
invalidParameterError,
|
||||
nativeError
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user