refactor [cdnjs] integration (#1668)

* pass error object to InvaildResponse()

this prevents us from throwing
TypeError: Cannot read property 'stack' of undefined
when we attempt to parse invalid json

* refactor [cdnjs] integration
This commit is contained in:
chris48s
2018-05-04 21:55:51 +01:00
committed by GitHub
parent b126b4ebdc
commit 8fcc13d5bc
4 changed files with 62 additions and 42 deletions

View File

@@ -39,7 +39,7 @@ async function asJson({ buffer, res }) {
try {
return JSON.parse(buffer);
} catch (err) {
throw new InvalidResponse();
throw new InvalidResponse(undefined, err);
}
};