0.2.1 • Published 7 years ago
lc-lambda-utils v0.2.1
lc-lambda-utils
Shared Utilities for Lightning CI Lambda Functions
Prerequisites
- Node.js 8.x
Installation
npm install lc-lambda-utils
oryarn add lc-lambda-utils
Usage
import { fetch, handleFetchError, FetchError } from 'lc-lambda-utils';
// Warning: env variables SUMO_URL and SLACK_URL must be present before using fetch responses
const fetchSomething = async () => {
const fetchResults = await fetch('foo' { method: 'POST' })
.then((res) => {
if (someCondition) {
throw new FetchError('an error for developers', 500, 'an error for the end user');
}
// Do something additional with the response if you want
return res;
})
.catch((err) => handleFetchError(err));
};
Development
yarn install
yarn run build