Socket
Socket
Sign inDemoInstall

@google-cloud/profiler

Package Overview
Dependencies
Maintainers
4
Versions
54
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@google-cloud/profiler - npm Package Compare versions

Comparing version 0.2.1 to 0.2.2

26

out/src/profiler.js

@@ -52,2 +52,14 @@ "use strict";

/**
* @return the message of the response body, if that field exists. Otherwise,
* returns the response status message.
*/
function getResponseErrorMessage(response) {
// tslint:disable-next-line: no-any
const body = response.body;
if (body && body.message && typeof body.message === 'string') {
return body.message;
}
return response.statusMessage;
}
/**
* @return number indicated by backoff if the response indicates a backoff and

@@ -57,4 +69,2 @@ * that backoff is greater than 0. Otherwise returns undefined.

function getServerResponseBackoff(response) {
// tslint:disable-next-line: no-any
const body = response.body;
// The response currently does not have field containing the server-specified

@@ -65,4 +75,5 @@ // backoff. As a workaround, response body's message is parsed to get the

// body.error.details.
if (body && body.message && typeof body.message === 'string') {
return parseBackoffDuration(body.message);
const message = getResponseErrorMessage(response);
if (message) {
return parseBackoffDuration(message);
}

@@ -134,4 +145,4 @@ return undefined;

class BackoffResponseError extends Error {
constructor(response, backoffMillis) {
super(response.statusMessage);
constructor(message, backoffMillis) {
super(message);
this.backoffMillis = backoffMillis;

@@ -177,5 +188,6 @@ }

if (response && isErrorResponseStatusCode(response.statusCode)) {
const message = getResponseErrorMessage(response);
const delayMillis = getServerResponseBackoff(response);
if (delayMillis) {
throw new BackoffResponseError(response, delayMillis);
throw new BackoffResponseError(message, delayMillis);
}

@@ -182,0 +194,0 @@ throw new Error(response.statusMessage);

{
"name": "@google-cloud/profiler",
"version": "0.2.1",
"version": "0.2.2",
"description": "Adds support for Stackdriver Profiler to node.js applications",

@@ -29,12 +29,14 @@ "repository": "GoogleCloudPlatform/cloud-profiler-nodejs",

"dependencies": {
"@google-cloud/common": "^0.23.0",
"@google-cloud/common": "^0.25.0",
"@types/console-log-level": "^1.4.0",
"@types/semver": "^5.5.0",
"bindings": "^1.2.1",
"console-log-level": "^1.4.0",
"delay": "^3.1.0",
"delay": "^4.0.1",
"extend": "^3.0.1",
"gcp-metadata": "^0.7.0",
"gcp-metadata": "^0.8.0",
"nan": "^2.8.0",
"parse-duration": "^0.1.1",
"pify": "^4.0.0",
"pretty-ms": "^3.1.0",
"pretty-ms": "^4.0.0",
"protobufjs": "~6.8.6",

@@ -45,3 +47,2 @@ "semver": "^5.5.0",

"devDependencies": {
"@types/console-log-level": "^1.4.0",
"@types/extend": "^3.0.0",

@@ -55,3 +56,2 @@ "@types/long": "^4.0.0",

"@types/request": "^2.47.1",
"@types/semver": "^5.5.0",
"@types/sinon": "^5.0.1",

@@ -64,3 +64,3 @@ "codecov": "^3.0.0",

"mocha": "^5.0.0",
"nock": "^9.0.22",
"nock": "^10.0.0",
"nyc": "^13.0.0",

@@ -70,3 +70,3 @@ "sinon": "^6.0.0",

"ts-mockito": "^2.2.5",
"typescript": "~3.0.0"
"typescript": "~3.1.0"
},

@@ -73,0 +73,0 @@ "files": [

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

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