本文整理汇总了TypeScript中z-schema.getLastErrors函数的典型用法代码示例。如果您正苦于以下问题:TypeScript getLastErrors函数的具体用法?TypeScript getLastErrors怎么用?TypeScript getLastErrors使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getLastErrors函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: objectNormalize
public objectNormalize(tx: IBaseTransaction<VoteAsset>): IBaseTransaction<VoteAsset> {
const report = this.schema.validate(tx.asset, voteSchema);
if (!report) {
throw new Error(`Failed to validate vote schema: ${this.schema.getLastErrors()
.map((err) => err.message).join(', ')}`);
}
return tx;
}
开发者ID:RiseVision,项目名称:rise-node,代码行数:9,代码来源:vote.ts
示例2: objectNormalize
public objectNormalize(tx: IBaseTransaction<DelegateAsset>): IBaseTransaction<DelegateAsset> {
removeEmptyObjKeys(tx.asset.delegate);
const report = this.schema.validate(tx.asset.delegate, delegateSchema);
if (!report) {
throw new Error(`Failed to validate delegate schema: ${this.schema.getLastErrors()
.map((err) => err.message).join(', ')}`);
}
return tx;
}
开发者ID:RiseVision,项目名称:rise-node,代码行数:11,代码来源:delegate.ts
示例3: validateAgainstSchemas
function validateAgainstSchemas(vlspec, done?) {
var isVlValid = validator.validate(vlspec, vlSchema);
var errors;
if (!isVlValid) {
errors = validator.getLastErrors();
console.log(inspect(errors, { depth: 10, colors: true }));
}
assert.deepEqual(isVlValid, true);
var vegaSpec = vl.compile(vlspec);
var isVgValid = validator.validate(vegaSpec, vgSchema);
if (!isVgValid) {
errors = validator.getLastErrors();
console.log(inspect(errors, { depth: 10, colors: true }));
}
assert.deepEqual(isVgValid, true);
if (done) {
done();
}
}
开发者ID:MikeWickwar,项目名称:firstyeoman,代码行数:24,代码来源:examples.test.ts
示例4: use
public use(request: express.Request, response: any, next: (err?: any) => any) {
castFieldsToNumberUsingSchema(
transportSchema.headers,
request.headers
);
if (!this.schema.validate(request.headers, transportSchema.headers)) {
this.removePeer(request);
return next(new Error(`${this.schema.getLastError().details[0].path
} - ${this.schema.getLastErrors()[0].message}`));
}
if (!this.systemModule.networkCompatible(request.headers.nethash as string)) {
this.removePeer(request);
// TODO: convert this into an error.
return next({
expected: this.systemModule.getNethash(),
message : 'Request is made on the wrong network',
received: request.headers.nethash,
});
}
if (!this.systemModule.versionCompatible(request.headers.version)) {
this.removePeer(request);
// TODO: Convert this into an error
return next({
expected: this.systemModule.getMinVersion(),
message : 'Request is made from incompatible version',
received: request.headers.version,
});
}
// Add peer only if not firewalled
if (typeof request.headers.firewalled === 'undefined' || request.headers.firewalled === 'false') {
const p = this.peersLogic.create(this.computeBasePeerType(request));
p.applyHeaders(request.headers as any);
this.peersModule.update(p);
}
next();
}
开发者ID:RiseVision,项目名称:rise-node,代码行数:38,代码来源:validatePeerHeaders.ts
注:本文中的z-schema.getLastErrors函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论