@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;

高级使用方式

Readme

Keywords

none

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