Socket
Socket
Sign inDemoInstall

@pnpm/error

Package Overview
Dependencies
Maintainers
3
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pnpm/error - npm Package Compare versions

Comparing version 1.2.0 to 1.3.0

CHANGELOG.md

15

lib/index.d.ts

@@ -10,4 +10,17 @@ export default class PnpmError extends Error {

constructor(code: string, message: string, opts?: {
hint: string;
hint?: string;
});
}
export declare type FetchErrorResponse = {
status: number;
statusText: string;
};
export declare type FetchErrorRequest = {
url: string;
authHeaderValue?: string;
};
export declare class FetchError extends PnpmError {
readonly response: FetchErrorResponse;
readonly request: FetchErrorRequest;
constructor(request: FetchErrorRequest, response: FetchErrorResponse, hint?: string);
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.FetchError = void 0;
class PnpmError extends Error {

@@ -11,2 +12,26 @@ constructor(code, message, opts) {

exports.default = PnpmError;
class FetchError extends PnpmError {
constructor(request, response, hint) {
let message = `GET ${request.url}: ${response.statusText} - ${response.status}`;
const authHeaderValue = request.authHeaderValue
? hideAuthInformation(request.authHeaderValue) : undefined;
if (response.status === 401 || response.status === 403) {
hint = hint ? `${hint}\n\n` : '';
if (authHeaderValue) {
hint += `An authorization header was used: ${authHeaderValue}`;
}
else {
hint += `No authorization header was set for the request.`;
}
}
super(`FETCH_${response.status}`, message, { hint });
this.request = request;
this.response = response;
}
}
exports.FetchError = FetchError;
function hideAuthInformation(authHeaderValue) {
const [authType, token] = authHeaderValue.split(' ');
return `${authType} ${token.substring(0, 4)}[hidden]`;
}
//# sourceMappingURL=index.js.map

59

package.json
{
"name": "@pnpm/error",
"version": "1.2.0",
"description": "An error class for pnpm errors",
"main": "lib/index.js",
"typings": "lib/index.d.ts",
"files": [
"lib",
"!*.map"
],
"engines": {
"node": ">=10.13"
},
"scripts": {
"lint": "tslint -c ../../tslint.json src/**/*.ts test/**/*.ts",
"test": "pnpm run compile",
"prepublishOnly": "pnpm run compile",
"compile": "rimraf lib tsconfig.tsbuildinfo && tsc --build"
},
"repository": "https://github.com/pnpm/pnpm/blob/master/packages/error",
"keywords": [
"pnpm",
"error"
],
"author": "Zoltan Kochan <z@kochan.io> (https://www.kochan.io/)",
"license": "MIT",
"bugs": {
"url": "https://github.com/pnpm/pnpm/issues"
},
"homepage": "https://github.com/pnpm/pnpm/blob/master/packages/error#readme"
"name": "@pnpm/error",
"version": "1.3.0",
"description": "An error class for pnpm errors",
"main": "lib/index.js",
"typings": "lib/index.d.ts",
"files": [
"lib",
"!*.map"
],
"engines": {
"node": ">=10.13"
},
"scripts": {
"lint": "tslint -c ../../tslint.json src/**/*.ts test/**/*.ts",
"test": "pnpm run compile",
"prepublishOnly": "pnpm run compile",
"compile": "rimraf lib tsconfig.tsbuildinfo && tsc --build"
},
"repository": "https://github.com/pnpm/pnpm/blob/master/packages/error",
"keywords": [
"pnpm",
"error"
],
"author": "Zoltan Kochan <z@kochan.io> (https://www.kochan.io/)",
"license": "MIT",
"bugs": {
"url": "https://github.com/pnpm/pnpm/issues"
},
"homepage": "https://github.com/pnpm/pnpm/blob/master/packages/error#readme",
"funding": "https://opencollective.com/pnpm"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc