feat(create-medusa-app): print error message for failed db connection (#5547)

`create-medusa-app` currently prints a generic error message when it cannot connect to a database. This tiny pull request adds the thrown error to the log message, that simplifies debugging of installation issues
This commit is contained in:
Egor Makarenko
2023-11-06 19:37:10 +03:00
committed by GitHub
parent 2576a0fd23
commit 09ab1d1be6
2 changed files with 6 additions and 1 deletions

View File

@@ -0,0 +1,5 @@
---
"create-medusa-app": patch
---
feat(create-medusa-app): print error message for failed database connection

View File

@@ -94,7 +94,7 @@ async function getForDbName(dbName: string): Promise<{
})
} catch (e) {
logMessage({
message: `Couldn't connect to PostgreSQL. Make sure you have PostgreSQL installed and the credentials you provided are correct.${EOL}${EOL}You can learn how to install PostgreSQL here: https://docs.medusajs.com/development/backend/prepare-environment?os=${getCurrentOs()}#postgresql${EOL}${EOL}If you keep running into this issue despite having PostgreSQL installed, please check out our troubleshooting guidelines: https://docs.medusajs.com/troubleshooting/database-error`,
message: `Couldn't connect to PostgreSQL because of the following error: ${e}.${EOL}${EOL}Make sure you have PostgreSQL installed and the credentials you provided are correct.${EOL}${EOL}You can learn how to install PostgreSQL here: https://docs.medusajs.com/development/backend/prepare-environment?os=${getCurrentOs()}#postgresql${EOL}${EOL}If you keep running into this issue despite having PostgreSQL installed, please check out our troubleshooting guidelines: https://docs.medusajs.com/troubleshooting/database-error`,
type: "error",
})
}