|
1
|
/** |
|
2
|
* Base URL of the database troubleshooting guide in the Medusa documentation. |
|
3
|
*/ |
|
4
|
export const DB_TROUBLESHOOTING_URL = |
|
5
|
"https://docs.medusajs.com/resources/troubleshooting/database-errors" |
|
6
|
|
|
7
|
/** |
|
8
|
* Anchors to specific sections of the database troubleshooting guide. |
|
9
|
*/ |
|
10
|
export const DBTroubleshootingSection = { |
|
11
|
MIGRATIONS: "error-while-running-migrations", |
|
12
|
} as const |
|
13
|
|
|
14
|
/** |
|
15
|
* Append a link to the database troubleshooting guide to an error message, so |
|
16
|
* connection failures point users to actionable next steps. |
|
17
|
* |
|
18
|
* @param message - The error message to append the link to. |
|
19
|
* @param section - An optional anchor to a specific section of the guide. |
|
20
|
*/ |
|
21
|
export function withDbTroubleshootingLink( |
|
22
|
message: string, |
|
23
|
section?: string |
|
24
|
): string { |
|
25
|
const url = section |
|
26
|
? `${DB_TROUBLESHOOTING_URL}#${section}` |
|
27
|
: DB_TROUBLESHOOTING_URL |
|
28
|
|
|
29
|
return `${message}\n\nSee ${url} for troubleshooting steps.` |
|
30
|
} |