auto-kubernetes-client
Advanced tools
Comparing version 0.4.2 to 0.4.3
{ | ||
"name": "auto-kubernetes-client", | ||
"version": "0.4.2", | ||
"version": "0.4.3", | ||
"description": "NodeJS Kubernetes Client with automatic API discoveryEdit", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -77,5 +77,26 @@ 'use strict'; | ||
} else { | ||
if (cooked && data.kind === 'Status' && data.status === 'Failure') { | ||
// Synthesize an error from the status | ||
return reject(Object.assign(data, new Error(data.message))); | ||
if (cooked) { | ||
let maybeStatus; | ||
if (typeof data === 'string') { | ||
// The server doesn't (always?) produce a Status for 401/403 errors it seems. | ||
// It should according to https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#http-status-codes, | ||
// but likely the authentication/authorization layer prevents that. | ||
// See https://github.com/kubernetes/kubernetes/issues/45970 | ||
maybeStatus = { | ||
kind: 'Status', | ||
apiVersion: 'v1', | ||
metadata: {}, | ||
status: 'Failure', | ||
message: data, | ||
reason: response.statusMessage, | ||
code: response.statusCode, | ||
}; | ||
} else { | ||
maybeStatus = data; | ||
} | ||
if (maybeStatus.kind === 'Status' && maybeStatus.status === 'Failure') { | ||
// Synthesize an error from the status | ||
return reject(Object.assign(maybeStatus, new Error(maybeStatus.message))); | ||
} | ||
} | ||
@@ -82,0 +103,0 @@ return resolve(data); |
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
32894
387