Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@lskjs/err

Package Overview
Dependencies
Maintainers
11
Versions
53
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lskjs/err - npm Package Compare versions

Comparing version 2.3.0-beta.86 to 2.3.0-beta.87

6

Err.js

@@ -22,4 +22,2 @@ "use strict";

var _forEach = _interopRequireDefault(require("lodash/forEach"));
var _errMerge = _interopRequireDefault(require("./errMerge"));

@@ -57,3 +55,5 @@

_this.name = _this.constructor.name;
(0, _forEach["default"])(err, function (val, key) {
Object.keys(err).forEach(function (key) {
var val = err[key];
if (key === 'message') {

@@ -60,0 +60,0 @@ if (_this.message !== val && val) {

{
"name": "@lskjs/err",
"version": "2.3.0-beta.86",
"version": "2.3.0-beta.87",
"description": "LSK.js – err – Error class and utils for custom code and message extracting",

@@ -30,3 +30,6 @@ "keywords": [],

"_type": "module",
"gitHead": "09d9dfcce60addaea2b1b0cbe4a1ac7b91ae7a36"
"devDependencies": {
"@types/lodash": "4.14.171"
},
"gitHead": "75e976432e08af9d42fb9b07f5af20182ebc99b0"
}
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = exports.Err = exports.isErr = void 0;
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
var _IErr = require("./IErr.types");
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
var _wrapNativeSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/wrapNativeSuper"));
var _forEach = _interopRequireDefault(require("lodash/forEach"));
var _errMerge = _interopRequireDefault(require("./errMerge"));
var _utils = require("./utils");
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
// eslint-disable-next-line @typescript-eslint/no-use-before-define
var _isErr = function isErr(err) {
return err instanceof Err;
};
exports.isErr = _isErr;
var Err = /*#__PURE__*/function (_Error) {
(0, _inherits2["default"])(Err, _Error);
var _super = _createSuper(Err);
// @ts-ignore
function Err() {
var _this;
(0, _classCallCheck2["default"])(this, Err);
var err = _errMerge["default"].apply(void 0, arguments);
_this = _super.call(this, (0, _utils.getMessage)(err));
_this.code = void 0;
_this.__err = true;
_this.name = _this.constructor.name;
(0, _forEach["default"])(err, function (val, key) {
if (key === 'message') {
if (_this.message !== val && val) {
// @ts-ignore
_this.__parentErrorMessage = val; // TODO: может не надо?
}
} else if (key === 'stack') {
// TODO: подумать в будущем, может надо сохранять?
// @ts-ignore
_this.__parentErrorStack = val; // console.log('this.stack', this.stack);
// console.log('err.stack', err.stack);
} else {
_this[key] = val;
}
});
if (!_this.code) _this.code = (0, _utils.getCode)(err);
return _this;
}
(0, _createClass2["default"])(Err, [{
key: "getText",
value: function getText() {
return (0, _utils.getText)(this);
Object.keys(_IErr).forEach(function (key) {
if (key === "default" || key === "__esModule") return;
if (key in exports && exports[key] === _IErr[key]) return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function get() {
return _IErr[key];
}
}, {
key: "getJSON",
value: function getJSON() {
var onlySafeField = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
return (0, _utils.getJSON)(this, onlySafeField);
}
}, {
key: "getMessage",
value: function getMessage() {
return (0, _utils.getMessage)(this);
}
}, {
key: "getCode",
value: function getCode() {
return (0, _utils.getCode)(this);
}
}, {
key: "toJSON",
value: function toJSON() {
var json = this.getJSON(true);
return json;
}
}], [{
key: "getMessage",
value: function getMessage(err) {
var def = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _utils.errUnknown;
return (0, _utils.getMessage)(err, def);
}
}, {
key: "getText",
value: function getText(err) {
var def = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _utils.errUnknown;
return (0, _utils.getText)(err, def);
}
}, {
key: "getCode",
value: function getCode(err) {
var def = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _utils.errUnknown;
return (0, _utils.getCode)(err, def);
}
}, {
key: "getJSON",
value: function getJSON(err) {
var onlySafeField = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
return (0, _utils.getJSON)(err, onlySafeField);
}
}, {
key: "isError",
value: function isError(err) {
return (0, _utils.isError)(err);
}
}, {
key: "isErr",
value: function isErr(err) {
return _isErr(err);
}
}]);
return Err;
}( /*#__PURE__*/(0, _wrapNativeSuper2["default"])(Error));
exports.Err = Err;
var _default = Err;
exports["default"] = _default;
});
});
//# sourceMappingURL=types.js.map

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc