diff --git a/lambda-http/src/lib.rs b/lambda-http/src/lib.rs index 2351383e..7fdcca56 100644 --- a/lambda-http/src/lib.rs +++ b/lambda-http/src/lib.rs @@ -17,9 +17,7 @@ //! your function's execution path. //! //! ```rust,no_run -//! use lambda_http::{handler, lambda_runtime}; -//! -//! type Error = Box; +//! use lambda_http::{handler, lambda_runtime::{self, Error}}; //! //! #[tokio::main] //! async fn main() -> Result<(), Error> { @@ -36,9 +34,7 @@ //! with the [`RequestExt`](trait.RequestExt.html) trait. //! //! ```rust,no_run -//! use lambda_http::{handler, lambda_runtime::{self, Context}, IntoResponse, Request, RequestExt}; -//! -//! type Error = Box; +//! use lambda_http::{handler, lambda_runtime::{self, Context, Error}, IntoResponse, Request, RequestExt}; //! //! #[tokio::main] //! async fn main() -> Result<(), Error> { @@ -66,8 +62,8 @@ extern crate maplit; pub use http::{self, Response}; -use lambda_runtime::Handler as LambdaHandler; pub use lambda_runtime::{self, Context}; +use lambda_runtime::{Error, Handler as LambdaHandler}; mod body; pub mod ext; @@ -85,9 +81,6 @@ use std::{ task::{Context as TaskContext, Poll}, }; -/// Error type that lambdas may result in -pub(crate) type Error = Box; - /// Type alias for `http::Request`s with a fixed [`Body`](enum.Body.html) type pub type Request = http::Request; diff --git a/lambda-runtime/examples/basic.rs b/lambda-runtime/examples/basic.rs index 999efdcc..d74e10de 100644 --- a/lambda-runtime/examples/basic.rs +++ b/lambda-runtime/examples/basic.rs @@ -1,15 +1,11 @@ // This example requires the following input to succeed: // { "command": "do something" } -use lambda_runtime::{handler_fn, Context}; +use lambda_runtime::{handler_fn, Context, Error}; use log::LevelFilter; use serde::{Deserialize, Serialize}; use simple_logger::SimpleLogger; -/// A shorthand for `Box` -/// type required by aws-lambda-rust-runtime. -pub type Error = Box; - /// This is also a made-up example. Requests come into the runtime as unicode /// strings in json format, which can map to any structure that implements `serde::Deserialize` /// The runtime pays no attention to the contents of the request payload. diff --git a/lambda-runtime/examples/error-handling.rs b/lambda-runtime/examples/error-handling.rs index f5ba2474..a0683f21 100644 --- a/lambda-runtime/examples/error-handling.rs +++ b/lambda-runtime/examples/error-handling.rs @@ -1,14 +1,11 @@ /// See https://github.com/awslabs/aws-lambda-rust-runtime for more info on Rust runtime for AWS Lambda -use lambda_runtime::handler_fn; +use lambda_runtime::{handler_fn, Error}; use log::LevelFilter; use serde::{Deserialize, Serialize}; use serde_json::{json, Value}; use simple_logger::SimpleLogger; use std::fs::File; -/// A shorthand for `Box` type required by aws-lambda-rust-runtime. -pub type Error = Box; - /// A simple Lambda request structure with just one field /// that tells the Lambda what is expected of it. #[derive(Deserialize)] diff --git a/lambda-runtime/src/lib.rs b/lambda-runtime/src/lib.rs index e05edbf4..a78da826 100644 --- a/lambda-runtime/src/lib.rs +++ b/lambda-runtime/src/lib.rs @@ -31,7 +31,7 @@ use requests::{EventCompletionRequest, EventErrorRequest, IntoRequest, NextEvent use types::Diagnostic; /// Error type that lambdas may result in -pub(crate) type Error = Box; +pub type Error = Box; /// Configuration derived from environment variables. #[derive(Debug, Default, Clone, PartialEq)]