Skip to content

Commit 61590b8

Browse files
committed
update api error handler to log error objects if passed in
1 parent 2cba6e1 commit 61590b8

File tree

5 files changed

+12
-4
lines changed

5 files changed

+12
-4
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
44

55
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html)
66

7+
## [2.1.1]  (2020-01-05)
8+
9+
### Added
10+
11+
- Api error response logs Error message if passed an Error object
12+
713
## [2.1.0]  (2020-01-04)
814

915
### Changed
@@ -137,6 +143,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/),
137143
- Update older libraries
138144
- Now publish from Git tags instead of master pushes
139145

146+
[2.1.1]: https://github.com/manwaring/lambda-wrapper/compare/v2.1.0...v2.1.1
140147
[2.1.0]: https://github.com/manwaring/lambda-wrapper/compare/v2.0.1...v2.1.0
141148
[2.0.1]: https://github.com/manwaring/lambda-wrapper/compare/v2.0.0...v2.0.1
142149
[2.0.0]: https://github.com/manwaring/lambda-wrapper/compare/v1.2.2...v2.0.0

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
# AWS Lambda wrapper library
1111

12-
### This documentation is for v2 of the library - see [old-docs/v1/README.md for the v1 documentation](old-docs/v1/README.md)
12+
### This documentation is for v2 of the library - [go here for v1 documentation](old-docs/v1/README.md)
1313

1414
1. [Overview](#overview)
1515
1. [Installation and setup](#installation-and-setup)

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@manwaring/lambda-wrapper",
33
"description": "A lambda handler wrapper to abstract common functionality and provide useful defaults",
4-
"version": "2.1.0",
4+
"version": "2.1.1",
55
"scripts": {
66
"publish-please-dry-run": "publish-please --dry-run",
77
"publish-please": "publish-please",

src/api/responses.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Metrics } from '../common';
1+
import { Metrics, logger } from '../common';
22

33
const DEFAULT_HEADERS = {
44
'Access-Control-Allow-Origin': '*',
@@ -37,6 +37,7 @@ export function notFound(message?: string): ApiResponse {
3737
export function error(message?: any): ApiResponse {
3838
const response = { statusCode: 503, headers: DEFAULT_HEADERS };
3939
if (message && message instanceof Error) {
40+
logger.debug('Encountered error while processing request', message);
4041
message = message.message;
4142
}
4243
if (message) {

0 commit comments

Comments
 (0)