Skip to content

Commit

Permalink
fix: better close() in client (#87)
Browse files Browse the repository at this point in the history
* [CHANGE ME] Re-generated  to pick up changes in the API or client library generator.

* chore: we're using release-please now for releases

Co-authored-by: Benjamin E. Coe <bencoe@google.com>
  • Loading branch information
2 people authored and alexander-fenster committed Jan 4, 2020
1 parent aab2575 commit 32d8c25
Show file tree
Hide file tree
Showing 9 changed files with 963 additions and 739 deletions.
1 change: 1 addition & 0 deletions packages/google-cloud-datacatalog/.nycrc
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"**/scripts",
"**/protos",
"**/test",
"**/*.d.ts",
".jsdoc.js",
"**/.jsdoc.js",
"karma.conf.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/google-cloud-datacatalog/protos/protos.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2019 Google LLC
// Copyright 2020 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion packages/google-cloud-datacatalog/protos/protos.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2019 Google LLC
// Copyright 2020 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,9 @@ export class DataCatalogClient {
for (const methodName of dataCatalogStubMethods) {
const innerCallPromise = this.dataCatalogStub.then(
stub => (...args: Array<{}>) => {
if (this._terminated) {
return Promise.reject('The client has already been closed.');
}
return stub[methodName].apply(stub, args);
},
(err: Error | null | undefined) => () => {
Expand All @@ -257,9 +260,6 @@ export class DataCatalogClient {
callOptions?: CallOptions,
callback?: APICallback
) => {
if (this._terminated) {
return Promise.reject('The client has already been closed.');
}
return apiCall(argument, callOptions, callback);
};
}
Expand Down Expand Up @@ -2681,7 +2681,7 @@ export class DataCatalogClient {
* @param {string} location
* @returns {string} Resource name string.
*/
entrygroupPath(project: string, location: string) {
entryGroupPath(project: string, location: string) {
return this._pathTemplates.entrygroupPathTemplate.render({
project,
location,
Expand Down Expand Up @@ -2768,7 +2768,7 @@ export class DataCatalogClient {
* @param {string} location
* @returns {string} Resource name string.
*/
tagtemplatePath(project: string, location: string) {
tagTemplatePath(project: string, location: string) {
return this._pathTemplates.tagtemplatePathTemplate.render({
project,
location,
Expand Down Expand Up @@ -2869,7 +2869,7 @@ export class DataCatalogClient {
* @param {string} field
* @returns {string} Resource name string.
*/
tagtemplatefieldPath(project: string, location: string, field: string) {
tagTemplateFieldPath(project: string, location: string, field: string) {
return this._pathTemplates.tagtemplatefieldPathTemplate.render({
project,
location,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,9 @@ export class PolicyTagManagerClient {
for (const methodName of policyTagManagerStubMethods) {
const innerCallPromise = this.policyTagManagerStub.then(
stub => (...args: Array<{}>) => {
if (this._terminated) {
return Promise.reject('The client has already been closed.');
}
return stub[methodName].apply(stub, args);
},
(err: Error | null | undefined) => () => {
Expand All @@ -237,9 +240,6 @@ export class PolicyTagManagerClient {
callOptions?: CallOptions,
callback?: APICallback
) => {
if (this._terminated) {
return Promise.reject('The client has already been closed.');
}
return apiCall(argument, callOptions, callback);
};
}
Expand Down Expand Up @@ -1550,7 +1550,7 @@ export class PolicyTagManagerClient {
* @param {string} taxonomy
* @returns {string} Resource name string.
*/
policytagPath(project: string, location: string, taxonomy: string) {
policyTagPath(project: string, location: string, taxonomy: string) {
return this._pathTemplates.policytagPathTemplate.render({
project,
location,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,9 @@ export class PolicyTagManagerSerializationClient {
for (const methodName of policyTagManagerSerializationStubMethods) {
const innerCallPromise = this.policyTagManagerSerializationStub.then(
stub => (...args: Array<{}>) => {
if (this._terminated) {
return Promise.reject('The client has already been closed.');
}
return stub[methodName].apply(stub, args);
},
(err: Error | null | undefined) => () => {
Expand All @@ -207,9 +210,6 @@ export class PolicyTagManagerSerializationClient {
callOptions?: CallOptions,
callback?: APICallback
) => {
if (this._terminated) {
return Promise.reject('The client has already been closed.');
}
return apiCall(argument, callOptions, callback);
};
}
Expand Down
Loading

0 comments on commit 32d8c25

Please sign in to comment.