Skip to content

Commit 50b71ae

Browse files
authored
[Do not merge] Refactor to address RFCs (#63)
* Refactor of the crate structure: Moved the "main loop" to a core crate that only handles `Vec<u8>` and changed the runtime handler to be a simple wrapper over the new core crate * Changed error handling to support any error type * Added LambdaErrorExt for the `error_type` field in the response and new derive crate for it.
1 parent bbf1958 commit 50b71ae

33 files changed

+2053
-936
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
/target
2+
/.cargo
23
lambda-runtime/libtest.rmeta

Cargo.lock

+350-239
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
[workspace]
22
members = [
33
"lambda-runtime-client",
4+
"lambda-runtime-core",
45
"lambda-runtime",
56
"lambda-http"
67
]

lambda-http/src/ext.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ pub enum PayloadError {
4949
/// extern crate lambda_runtime as lambda;
5050
/// #[macro_use] extern crate serde_derive;
5151
///
52-
/// use lambda::{Context, HandlerError};
52+
/// use lambda::{Context, error::HandlerError};
5353
/// use lambda_http::{Body, Request, Response, RequestExt};
5454
///
5555
/// #[derive(Debug,Deserialize,Default)]
@@ -67,7 +67,7 @@ pub enum PayloadError {
6767
/// fn handler(
6868
/// request: Request,
6969
/// ctx: lambda::Context
70-
/// ) -> Result<Response<Body>, lambda::HandlerError> {
70+
/// ) -> Result<Response<Body>, HandlerError> {
7171
/// let args: Args = request.payload()
7272
/// .unwrap_or_else(|_parse_err| None)
7373
/// .unwrap_or_default();

lambda-http/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
//!
1515
//! ```rust,no_run
1616
//! use lambda_http::{lambda, IntoResponse, Request, RequestExt};
17-
//! use lambda_runtime::{Context, HandlerError};
17+
//! use lambda_runtime::{Context, error::HandlerError};
1818
//!
1919
//! fn main() {
2020
//! lambda!(hello)

lambda-runtime-client/Cargo.toml

+2-1
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,5 @@ serde = "^1"
2323
serde_json = "^1"
2424
serde_derive = "^1"
2525
log = "0.4"
26-
backtrace = "0.3"
26+
lambda_runtime_errors = { path = "../lambda-runtime-errors", version = "^0.1" }
27+
failure = "^0.1"

0 commit comments

Comments
 (0)