All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.amazonaws.services.lambda.runtime.api.client.LambdaRequestHandler Maven / Gradle / Ivy

There is a newer version: 2.6.0
Show newest version
/* Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. */

package com.amazonaws.services.lambda.runtime.api.client;

import com.amazonaws.services.lambda.runtime.api.client.runtimeapi.InvocationRequest;

import java.io.ByteArrayOutputStream;

public interface LambdaRequestHandler {
    ByteArrayOutputStream call(InvocationRequest request) throws Error, Exception;

    class UserFaultHandler implements LambdaRequestHandler {
        public final UserFault fault;

        public UserFaultHandler(UserFault fault) {
            this.fault = fault;
        }

        public ByteArrayOutputStream call(InvocationRequest request) {
            throw fault;
        }
    }

    static LambdaRequestHandler initErrorHandler(final Throwable e, String className) {
        return new UserFaultHandler(UserFault.makeInitErrorUserFault(e, className));
    }

    static LambdaRequestHandler classNotFound(final Throwable e, String className) {
        return new UserFaultHandler(UserFault.makeClassNotFoundUserFault(e, className));
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy