@serverless-devs/http-error-handler

0.0.4-alpha.38 • Public • Published

设计原则

Fc 函数计算的参数格式为(req, res, context)。第一个参数 req 的参数类型为 readable Stream。将 req 转换为 JSON Object 的类型

基础使用方式

请求报错时,可以正常返回报错信息

'use strict';
const dk = require('@serverless-devs/dk-core');
const httpErrorHandler = require('@serverless-devs/http-error-handler');

const handler = dk((request) => {
  throw new Error();
});

handler.use(httpErrorHandler());

exports.handler = handler;

高级使用方式

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
0.0.4-alpha.381latest

Version History

VersionDownloads (Last 7 Days)Published
0.0.4-alpha.381
0.0.4-alpha.371
0.0.4-alpha.361
0.0.4-alpha.351
0.0.4-alpha.341
0.0.4-alpha.321
0.0.4-alpha.311
0.0.4-alpha.291
0.0.4-alpha.281
0.0.4-alpha.271
0.0.4-alpha.261

Package Sidebar

Install

npm i @serverless-devs/http-error-handler

Weekly Downloads

11

Version

0.0.4-alpha.38

License

ISC

Unpacked Size

8.61 kB

Total Files

10

Last publish

Collaborators

  • serverlessfans
  • heimanba
  • xsahxl