@octokit/rest
Advanced tools
Comparing version 14.0.8 to 14.0.9
@@ -6,3 +6,3 @@ 'use strict' | ||
const set = require('lodash/set') | ||
const errors = require('../../request/errors') | ||
const HttpError = require('../../request/http-error') | ||
@@ -28,3 +28,3 @@ function validate (endpointParams, options) { | ||
(parameter['allow-null'] === false && paramIsNull)) { | ||
throw new errors.BadRequest(`Empty value for parameter '${parameterName}': ${value}`) | ||
throw new HttpError(`Empty value for parameter '${parameterName}': ${value}`, 400) | ||
} | ||
@@ -34,3 +34,3 @@ | ||
if (parameter.enum.indexOf(value) === -1) { | ||
throw new errors.BadRequest(`Invalid value for parameter '${parameterName}': ${value}`) | ||
throw new HttpError(`Invalid value for parameter '${parameterName}': ${value}`, 400) | ||
} | ||
@@ -42,3 +42,3 @@ } | ||
if (!regex.test(value)) { | ||
throw new errors.BadRequest(`Invalid value for parameter '${parameterName}': ${value}`) | ||
throw new HttpError(`Invalid value for parameter '${parameterName}': ${value}`, 400) | ||
} | ||
@@ -50,3 +50,3 @@ } | ||
if (isNaN(value)) { | ||
throw new errors.BadRequest(`Invalid value for parameter '${parameterName}': ${options[parameterName]} is NaN`) | ||
throw new HttpError(`Invalid value for parameter '${parameterName}': ${options[parameterName]} is NaN`, 400) | ||
} | ||
@@ -59,3 +59,3 @@ } | ||
} catch (exception) { | ||
throw new errors.BadRequest(`JSON parse error of value for parameter '${parameterName}': ${value}`) | ||
throw new HttpError(`JSON parse error of value for parameter '${parameterName}': ${value}`, 400) | ||
} | ||
@@ -62,0 +62,0 @@ } |
module.exports = getPage | ||
const errors = require('../../request/errors') | ||
const HttpError = require('../../request/http-error') | ||
const getPageLinks = require('./get-page-links') | ||
@@ -15,3 +15,3 @@ | ||
if (!url) { | ||
const urlError = new errors.NotFound(`No ${which} page found`) | ||
const urlError = new HttpError(`No ${which} page found`, 404) | ||
if (callback) { | ||
@@ -18,0 +18,0 @@ return callback(urlError) |
@@ -14,3 +14,3 @@ 'use strict' | ||
const errors = require('./errors') | ||
const HttpError = require('./http-error') | ||
@@ -64,3 +64,3 @@ function httpRequest (requestOptions) { | ||
response.on('error', (error) => { | ||
reject(new errors.InternalServerError(error.message)) | ||
reject(new HttpError(error.message, 500)) | ||
}) | ||
@@ -75,3 +75,3 @@ response.on('end', () => { | ||
if (response.statusCode === 304 || response.statusCode >= 400 || response.statusCode < 10) { | ||
reject(new errors.HttpError(data, response.statusCode, response.headers)) | ||
reject(new HttpError(data, response.statusCode, response.headers)) | ||
return | ||
@@ -96,3 +96,3 @@ } | ||
debug('REQUEST ERROR: ' + error.message) | ||
reject(new errors.InternalServerError(error.message)) | ||
reject(new HttpError(error.message, 500)) | ||
}) | ||
@@ -107,3 +107,3 @@ | ||
aborted = true | ||
reject(new errors.GatewayTimeout('Request timeout')) | ||
reject(new HttpError('Request timeout', 504)) | ||
}) | ||
@@ -110,0 +110,0 @@ |
{ | ||
"name": "@octokit/rest", | ||
"version": "14.0.8", | ||
"version": "14.0.9", | ||
"publishConfig": { | ||
@@ -40,8 +40,5 @@ "access": "public" | ||
"debug": "^3.1.0", | ||
"dotenv": "^4.0.0", | ||
"https-proxy-agent": "^2.1.0", | ||
"is-array-buffer": "^1.0.0", | ||
"is-stream": "^1.1.0", | ||
"lodash": "^4.17.4", | ||
"proxy-from-env": "^1.0.0", | ||
"url-template": "^2.0.8" | ||
@@ -54,2 +51,3 @@ }, | ||
"coveralls": "^3.0.0", | ||
"dotenv": "^5.0.0", | ||
"gh-pages-with-token": "^1.0.0", | ||
@@ -56,0 +54,0 @@ "glob": "^7.1.2", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6
557947
20
14649
- Removeddotenv@^4.0.0
- Removedhttps-proxy-agent@^2.1.0
- Removedproxy-from-env@^1.0.0
- Removedagent-base@4.3.0(transitive)
- Removeddotenv@4.0.0(transitive)
- Removedes6-promise@4.2.8(transitive)
- Removedes6-promisify@5.0.0(transitive)
- Removedhttps-proxy-agent@2.2.4(transitive)
- Removedproxy-from-env@1.1.0(transitive)