hemerajs / hemera

🔬 Writing reliable & fault-tolerant microservices in Node.js https://hemerajs.github.io/hemera/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Handled errors are being logged in the client

leolower opened this issue · comments

Description

Errors are logged in the client even if they are handled directly.

Steps to Reproduce

  1. Service A makes a call to service B.
  2. B responds with an error or simply throws.
  3. A catches the error and deals with it.

Actual Result

The error is logged even though it was handled in the client

Expected Result

Unhandled errors should probably crash the app. Handled errors are not logged (or explicitly logged by the handled). Another option would be to configure log levels so that they ca be ignored.

Context

  • nats-hemera (core)
  • hemera-zipkin
  • hemera-store
  • hemera-stats
  • hemera-rabbitmq
  • hemera-nsq
  • hemera-elasticsearch
  • hemera-joi
  • hemera-msgpack
  • hemera-avro
  • hemera-jwt-auth

Your Environment

  • NATS: latest docker image available
  • Hemera: 3.5.1
  • NodeJs: 8.9
  • Operating System and version: Ubuntu 17.10

Hi @leolower thanks for reporting.
At the moment an error is logged when the client receives a response error. This is not ideal because we will log an error even when the application will handle it correctly. We should remove it. That's the only point.

Unhandled errors should probably crash the app

This is valid for thrown errors inside add with callback-style with async/await or promises it will only return a rejected promise.

Released with 5.4.2