Skip to content

Commit

Permalink
Fix Error Message Issue.
Browse files Browse the repository at this point in the history
  • Loading branch information
prpatel05 committed Feb 5, 2021
1 parent 2e2b1c4 commit ac2ae27
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
3 changes: 2 additions & 1 deletion lib/simple-affiliate.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@ SimpleAffiliate.prototype.createAffiliateLink = async function createAffiliateLi
}),
headers: { 'Content-Type': 'application/json' }
});
const responseClone = response.clone();
try {
return await response.json();
} catch (e) {
console.error("Cannot Process JSON - ", await response.text());
console.error("Cannot Process JSON - ", await responseClone.text());
throw e;
}
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "simple-affiliate",
"version": "0.0.3",
"version": "0.0.4",
"description": "Library to interact with the simple-affiliate APIs",
"main": "index.js",
"types": "index.d.ts",
Expand Down
11 changes: 9 additions & 2 deletions test/simple-affiliate.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ const loadMocks = () => {
resolve({
json: () => {
return {test: "test"};
},
clone: () => {
return this;
}
});
});
Expand All @@ -31,8 +34,12 @@ const loadBadMocks = () => {
json: () => {
throw Error();
},
text: () => {
return "text";
clone: () => {
return {
text: () => {
return "text";
},
}
}
});
});
Expand Down

0 comments on commit ac2ae27

Please sign in to comment.