Skip to content
This repository was archived by the owner on Aug 8, 2024. It is now read-only.

Commit 9f562e6

Browse files
author
ujann
committed
some formatting
1 parent 770324a commit 9f562e6

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

lib/proxyIntegration.js

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,19 @@ function process(proxyIntegrationConfig, event) {
5151
try {
5252
event.body = JSON.parse(event.body);
5353
} catch (parseError) {
54-
return Promise.resolve({statusCode: 400, headers: headers, body: 'body is not a valid JSON'});
54+
return Promise.resolve({
55+
statusCode: 400,
56+
headers: headers,
57+
body: 'body is not a valid JSON'
58+
});
5559
}
5660
}
5761
return Promise.resolve(actionConfig.action(event)).then(res => {
58-
return {statusCode: 200, headers: headers, body: JSON.stringify(res)};
62+
return {
63+
statusCode: 200,
64+
headers: headers,
65+
body: JSON.stringify(res)
66+
};
5967
}).catch(err => {
6068
return convertError(err, errorMapping, headers);
6169
});
@@ -85,9 +93,16 @@ function convertError(error, errorMapping, headers) {
8593
return {statusCode: error.status, body: JSON.stringify(error.message), headers: addCorsHeaders({})};
8694
}
8795
try{
88-
return {statusCode: 500, body: `Generic error: ${JSON.stringify(error)}`, headers: addCorsHeaders({})};
96+
return {
97+
statusCode: 500,
98+
body: `Generic error: ${JSON.stringify(error)}`,
99+
headers: addCorsHeaders({})
100+
};
89101
}catch(stringifyError){}
90-
return {statusCode: 500, body: `Generic error: ${error.stack ? error.stack : error}`};
102+
return {
103+
statusCode: 500,
104+
body: `Generic error: ${error.stack ? error.stack : error}`
105+
};
91106
}
92107

93108
function findMatchingActionConfig(httpMethod, httpPath, routeConfig) {

0 commit comments

Comments
 (0)