Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(microservices): fix redundant code to emit error #13328

Merged
merged 1 commit into from
Mar 17, 2024

Conversation

youngkiu
Copy link
Contributor

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Other... Please describe:

What is the current behavior?

Issue Number: N/A

What is the new behavior?

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

From #13195

              call.emit('error', err);
              subscription.unsubscribe();
              reject(err);

The bug was fixed by adding call.emit('error', err) before subscription.unsubscribe().

      try {
        await this.writeObservableToGrpc(result$, call);
      } catch (err) {
        call.emit('error', err);
        return;
      }

The call.emit('error', err); of the catch statement by reject() is a code that does not work because it follows subscription.unsubscribe();.

If you only look at the try catch statement without looking inside the writeObservableToGrpc() function, call.emit('error', err); is a misleading code and should be deleted.

@coveralls
Copy link

Pull Request Test Coverage Report for Build c47557dc-e8dd-414c-beb0-7598c1a72576

Details

  • 2 of 2 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.02%) to 92.181%

Totals Coverage Status
Change from base Build 14a5790e-1a63-471c-9a82-c6e1ef81c364: 0.02%
Covered Lines: 6732
Relevant Lines: 7303

💛 - Coveralls

@kamilmysliwiec kamilmysliwiec merged commit 1bf2dc4 into nestjs:master Mar 17, 2024
5 checks passed
@kamilmysliwiec
Copy link
Member

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants