This repository has been archived by the owner on Oct 21, 2022. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from OpenFn/v_1
V 1
- Loading branch information
Showing
9 changed files
with
492 additions
and
657 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
"use strict"; | ||
|
||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.assembleError = assembleError; | ||
exports.tryJson = tryJson; | ||
function assembleError(_ref) { | ||
var response = _ref.response, | ||
error = _ref.error; | ||
|
||
if ([200, 201, 202].indexOf(response.statusCode) > -1) return false; | ||
if (error) return error; | ||
return new Error("Server responded with " + response.statusCode); | ||
} | ||
|
||
function tryJson(data) { | ||
try { | ||
return JSON.parse(data); | ||
} catch (e) { | ||
return data; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.