Skip to content

Commit 67cd026

Browse files
committed
finch run --rm --entrypoint /bin/sh -v $(pwd):/wee -w /wee ubuntu:24.04 -c "apt-get update && apt-get -y install clang-format && clang-format -i src/runtime.cpp include/aws/lambda-runtime/runtime.h"
1 parent 41feb15 commit 67cd026

2 files changed

Lines changed: 20 additions & 11 deletions

File tree

include/aws/lambda-runtime/runtime.h

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -102,12 +102,14 @@ class invocation_response {
102102
// To support clients that need to control the entire error response body (e.g. adding a stack trace), this
103103
// constructor should be used instead.
104104
// Note: adding an overload to invocation_response::failure is not feasible since the parameter types are the same.
105-
invocation_response(std::string const& payload, std::string const& content_type, bool success, std::string const& xray_response = ""):
106-
m_payload(payload),
107-
m_content_type(content_type),
108-
m_success(success),
109-
m_xray_response(xray_response)
110-
{}
105+
invocation_response(
106+
std::string const& payload,
107+
std::string const& content_type,
108+
bool success,
109+
std::string const& xray_response = "")
110+
: m_payload(payload), m_content_type(content_type), m_success(success), m_xray_response(xray_response)
111+
{
112+
}
111113

112114
/**
113115
* Create a successful invocation response with the given payload and content-type.
@@ -118,7 +120,10 @@ class invocation_response {
118120
* Create a failure response with the given error message and error type.
119121
* The content-type is always set to application/json in this case.
120122
*/
121-
static invocation_response failure(std::string const& error_message, std::string const& error_type, std::string const& xray_response = "");
123+
static invocation_response failure(
124+
std::string const& error_message,
125+
std::string const& error_type,
126+
std::string const& xray_response = "");
122127

123128
/**
124129
* Get the MIME type of the payload.
@@ -136,8 +141,8 @@ class invocation_response {
136141
bool is_success() const { return m_success; }
137142

138143
/**
139-
* Get the XRay response string. The string isassumed to be UTF-8 encoded.
140-
*/
144+
* Get the XRay response string. The string isassumed to be UTF-8 encoded.
145+
*/
141146
std::string const& get_xray_response() const { return m_xray_response; }
142147
};
143148

src/runtime.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,8 @@ runtime::post_outcome runtime::do_post(
348348
}
349349

350350
if (!handler_response.get_xray_response().empty()) {
351-
headers = curl_slist_append(headers, ("lambda-runtime-function-xray-error-cause: " + handler_response.get_xray_response()).c_str());
351+
headers = curl_slist_append(
352+
headers, ("lambda-runtime-function-xray-error-cause: " + handler_response.get_xray_response()).c_str());
352353
}
353354
headers = curl_slist_append(headers, "Expect:");
354355
headers = curl_slist_append(headers, "transfer-encoding:");
@@ -524,7 +525,10 @@ invocation_response invocation_response::success(std::string payload, std::strin
524525
}
525526

526527
AWS_LAMBDA_RUNTIME_API
527-
invocation_response invocation_response::failure(std::string const& error_message, std::string const& error_type, std::string const& xray_response)
528+
invocation_response invocation_response::failure(
529+
std::string const& error_message,
530+
std::string const& error_type,
531+
std::string const& xray_response)
528532
{
529533
invocation_response r;
530534
r.m_success = false;

0 commit comments

Comments
 (0)