@pnpm/error
Advanced tools
Comparing version 6.0.0 to 6.0.1
@@ -16,6 +16,9 @@ "use strict"; | ||
constructor(request, response, hint) { | ||
const _request = { | ||
url: request.url, | ||
}; | ||
if (request.authHeaderValue) { | ||
_request.authHeaderValue = hideAuthInformation(request.authHeaderValue); | ||
} | ||
const message = `GET ${request.url}: ${response.statusText} - ${response.status}`; | ||
const authHeaderValue = request.authHeaderValue | ||
? hideAuthInformation(request.authHeaderValue) | ||
: undefined; | ||
// NOTE: For security reasons, some registries respond with 404 on authentication errors as well. | ||
@@ -25,4 +28,4 @@ // So we print authorization info on 404 errors as well. | ||
hint = hint ? `${hint}\n\n` : ''; | ||
if (authHeaderValue) { | ||
hint += `An authorization header was used: ${authHeaderValue}`; | ||
if (_request.authHeaderValue) { | ||
hint += `An authorization header was used: ${_request.authHeaderValue}`; | ||
} | ||
@@ -34,3 +37,3 @@ else { | ||
super(`FETCH_${response.status}`, message, { hint }); | ||
this.request = request; | ||
this.request = _request; | ||
this.response = response; | ||
@@ -42,2 +45,7 @@ } | ||
const [authType, token] = authHeaderValue.split(' '); | ||
if (token == null) | ||
return '[hidden]'; | ||
if (token.length < 20) { | ||
return `${authType} [hidden]`; | ||
} | ||
return `${authType} ${token.substring(0, 4)}[hidden]`; | ||
@@ -44,0 +52,0 @@ } |
{ | ||
"name": "@pnpm/error", | ||
"version": "6.0.0", | ||
"version": "6.0.1", | ||
"description": "An error class for pnpm errors", | ||
@@ -27,3 +27,3 @@ "main": "lib/index.js", | ||
"devDependencies": { | ||
"@pnpm/error": "6.0.0" | ||
"@pnpm/error": "6.0.1" | ||
}, | ||
@@ -37,6 +37,7 @@ "dependencies": { | ||
"scripts": { | ||
"lint": "eslint \"src/**/*.ts\"", | ||
"test": "pnpm run compile", | ||
"lint": "eslint \"src/**/*.ts\" \"test/**/*.ts\"", | ||
"_test": "jest", | ||
"test": "pnpm run compile && pnpm run _test", | ||
"compile": "tsc --build && pnpm run lint --fix" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
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
7820
89