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

@hzab/data-model

Package Overview
Dependencies
Maintainers
2
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hzab/data-model - npm Package Compare versions

Comparing version 0.1.1 to 0.1.2

2

package.json
{
"name": "@hzab/data-model",
"version": "0.1.1",
"version": "0.1.2",
"description": "data model",

@@ -5,0 +5,0 @@ "main": "src",

import _ from "lodash";
import axios from "axios";
const _$Temp = {};
const DEFAULT_MSG = "未知错误";
const _$Temp = {
defaultMsg: DEFAULT_MSG,
};

@@ -284,12 +287,13 @@ class DataModel {

// 前缀 _ 避免与 data 里已有的 message 冲突
_data._message = message || msg;
_data._msg = message || msg;
_data._message = _data._msg;
}
resolve(_data);
} else {
const error = new Error(message || msg);
const _msg = message || msg || _$Temp.defaultMsg;
const error = new Error(_msg);
error.code = code;
error.response = response;
error._message = message || msg;
error._msg = message || msg;
error._msg = _msg;
error._message = _msg;
reject(error);

@@ -302,4 +306,8 @@ }

if (response) {
const message = (response.data && (response.data.message || response.data.msg)) || response.msg;
const error = new Error(message || response.statusText || "未知错误");
const message =
(response.data && (response.data.message || response.data.msg)) ||
response.msg ||
response.statusText ||
_$Temp.defaultMsg;
const error = new Error(message);
error.code = response.status;

@@ -314,3 +322,3 @@ error.response = response;

}
return reject(err);
return reject(err || { _msg: _$Temp.defaultMsg });
}

@@ -325,4 +333,10 @@ }

export function setDefaultErrMsg(msg) {
if (msg) {
_$Temp.defaultMsg = msg;
}
}
export { axios, DataModel, setDefaultAxios };
export default DataModel;
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