nestjs / typeorm

TypeORM module for Nest framework (node.js) 🍇

Home Page:https://nestjs.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Include Connection Name in error message

dsbert opened this issue · comments

I'm submitting a...


[ ] Regression 
[ ] Bug report
[X] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.

Current behavior

When a database connection fails, an error is reported. This error does not contain any information on which connection failed. If the application is configured with multiple named connections, each one has to be verified manually.

[Nest] 18572   - 05/20/2020, 12:00:06 PM   [TypeOrmModule] Unable to connect to the database. Retrying (8)... +23ms
ConnectionError: Failed to connect to localhost:1433 - Could not connect (sequence)
    at ...

Expected behavior

The connection name should be included in the error message.

[Nest] 18572   - 05/20/2020, 12:00:06 PM   [TypeOrmModule] Unable to connect to the database (NamedConnection). Retrying (8)... +23ms
ConnectionError: Failed to connect to localhost:1433 - Could not connect (sequence)
    at ...

Minimal reproduction of the problem with instructions

  1. Configure a named connection that points to a non-existent database
  2. Attempt to connect

What is the motivation / use case for changing the behavior?

This will greatly help troubleshooting when multiple named connections are being used.

Environment


Nest version: 7.0.7

 
For Tooling issues:
- Node version: 12.16.1 
- Platform:  Windows 

Others:

Would you like to create a PR for this issue?

Done