Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

import middy from '@middy/core';
// Business logic
const businessLogic = async (event) => {
...
return myResponse;
};
// Configuration
export const myHandler = middy(businessLogic).onError(handleError);
class CustomError extends Error {
constructor(statusCode, { key, message }) {
super(message);
this.statusCode = statusCode;
this.key = key;
}
}
export class BadRequestError extends CustomError {
constructor({