diff --git a/src/debug.ts b/src/debug.ts index 807413ea1..b7856dd44 100644 --- a/src/debug.ts +++ b/src/debug.ts @@ -12,8 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -import {grpc} from 'google-gax'; - /** * Represents a debug message the user might want to print out for logging * while debugging or whatnot. These will always come by way of the 'error' @@ -33,7 +31,6 @@ import {grpc} from 'google-gax'; export class DebugMessage { constructor( public message: string, - public error?: Error, - public status?: grpc.StatusObject + public error?: Error ) {} } diff --git a/src/message-stream.ts b/src/message-stream.ts index 2d9ebc760..073658382 100644 --- a/src/message-stream.ts +++ b/src/message-stream.ts @@ -384,13 +384,14 @@ export class MessageStream extends PassThrough { private _onEnd(index: number, status: grpc.StatusObject): void { this._removeStream(index); + const statusError = new StatusError(status); + if (PullRetry.retry(status)) { this.emit( 'debug', new DebugMessage( `Subscriber stream ${index} has ended with status ${status.code}; will be retried.`, - undefined, - status + statusError ) ); if (PullRetry.resetFailures(status)) { @@ -404,8 +405,7 @@ export class MessageStream extends PassThrough { 'debug', new DebugMessage( `Subscriber stream ${index} has ended with status ${status.code}; will not be retried.`, - undefined, - status + statusError ) );