UNPKG

@studyportals/sp-r2d2

Version:

A framework that contains various components used when developing projects that will be deployed via AWS λ.

52 lines (51 loc) 1.91 kB
import { IResult } from '@studyportals/sp-r2d2-interface'; import { AuthorizationError, ValidationError, ExecutionError } from '../../../application'; /** * Offers the necessary functionality to send a response * back to the Lambda call initiator. */ export interface IResponseSender { /** * Sends a pong in response to the given ping. * * @param ping The ping whose response is to be sent. */ sendPong(ping: any): Promise<void>; /** * Sends the given uncaught error. * * @param error The uncaught error for whom a response is to be sent. */ sendUncaughtError(error: Error): Promise<void>; /** * Sends the given error, encountered while trying to authorize the request. * * @param error The authorization error for whom a response is to be sent. */ sendRequestAuthorizationError(error: AuthorizationError): Promise<void>; /** * Sends the request outcome, reached without executing the handler due to an ignored event * * @param event The event which has been ignored */ sendEventIgnored(event: any): Promise<void>; /** * Sends the given error, encountered while validating the request's content. * * @param error The validation error for whom a response is to be sent. */ sendRequestValidationError(error: ValidationError): Promise<void>; /** * Sends the given error, encountered while executing the request. * * @param error The execution error for whom a response is to be sent. */ sendRequestExecutionError(error: ExecutionError): Promise<void>; /** * Sends the request execution's outcome, reached without * encountering any errors. * * @param outcome The outcome the request's execution. */ sendExecutionOutcome(outcome: IResult): Promise<void>; }