return-msg
v2.0.14
Published
程序返回标准规范
Downloads
6
Readme
HEAD
return-msg
介绍
程序返回值标准.
使用说明
引用
npm install return-msg
样例
import {IReturnMsg,ReturnMsg} from "return-msg";
const rr:ReturnMsg = new ReturnMsg();
console.log(rr.ok);
const result={greet:'hello'};
const r:IReturnMsg=rr.returnResult(result);
console.log(r);
const e:IReturnMsg=rr.returnErr(1);
console.log(e);
const err:any = {stack:'MongoError: E11000 duplicate key error collection This is an err test!!!'};
console.log(rr.test(err));
返回信息库
{"errcode":0, "errmsg" :"ok"},
{"errcode":1,"errmsg":"用户名不存在!"},
{"errcode":2,"errmsg":"密码不正确!"},
{"errcode":3,"errmsg":"该用户名已经存在,请使用其它用户名!"},
{"errcode":4,"errmsg":"密码不符合校验条件!"},
{"errcode":901,"errmsg":"返回错误出现重复值,请检查!","errstack":"MongoError: E11000 duplicate key error collection"},
{"errcode":999,"errmsg":"出现系统错误,请联系开发人员!"}
参与贡献
zx
end