Skip to main content

Catch Error in HTTP Request

This job was provided by an OpenFn.org user via the job library API.

Metadata

  • Name: Catch Error in HTTP Request
  • Adaptor: @openfn/language-http
  • Adaptor Version: latest
  • Created over 8 years ago
  • Updated about 2 years ago
  • Score: 0 (an indicator of how useful this job may be)

Key Functions

get, JSON

Expression

get(
'https://jsonplaceholder.typicode.com/wrongUrl', // the url
{
transformResponse: [
data => {
console.log("The data from the response, BEFORE the error is thrown");
console.log(JSON.stringify(data, null, 2))
return data;
}
],
}, // no additional options
state => { // the callback
console.log('the data', state.data)
return state;
}
);