Improve error handling in short (186 lines) Node.js 6.10 program - 3 functions

Closed Posted 6 years ago Paid on delivery
Closed Paid on delivery

I have a short piece of code that runs in Node.js in a AWS Lambda call.

It makes a https call and stores the results to a data file. Last week the header returned from the https call changed a little and I realized my error handling is less than perfect.

When there are no errors the program works! When there are errors they don't seem to be handled well

You will not be able to run this code against the server! It's too much trouble to make this happen. So I just need you to edit the code, document it, and send it back.

Specific things I know are not great:

1. If the headers returned from the https call are not correct the program keeps going and does not return immediately. ([login to view URL]['content-type'] started comming back as 'application/json;charset=UTF-8'' instead of 'application/json' which it had been.

2. If there is a body['error_description'] the program keeps going.

3. Is it ok / good to redefine body in body = [login to view URL](body);

I am sure there are more.

I don't do a lot of programming in Node.js or javascript so looking for guidance and implementation best practices in this short piece of code.

Also document the code as much as necessary or possible.

Amazon Web Services JavaScript Node.js

Project ID: #15955231

About the project

2 proposals Remote project Active 6 years ago

2 freelancers are bidding on average $163 for this job

rbluethl

I can offer coding your Lambda function from scratch in TypeScript rather than JavaScript, which makes it more readable, extendable and reliable. Have a look at my review where I did exactly this. Relevant Skills and More

$300 USD in 3 days
(1 Review)
2.8