UNPKG

@mikeycoxon/aws-lambda-event-http-router

Version:

AWS Lambda handler utility for HTTP REST request routing based on details in the APIGatewayProxyEvent

19 lines (18 loc) 500 B
import { StatusCodes } from 'http-status-codes'; import { ApiError } from './ApiError.js'; export class UnauthorizedError extends ApiError { static format(e) { return { statusCode: 401, headers: { 'content-type': 'text/plain' }, body: e.message, }; } constructor(message, statusCode) { super(message); this.statusCode = statusCode; this.statusCode = StatusCodes.UNAUTHORIZED; } }