mirror of https://github.com/nocodb/nocodb
աɨռɢӄաօռɢ
2 years ago
committed by
GitHub
3 changed files with 47 additions and 0 deletions
@ -0,0 +1,27 @@ |
|||||||
|
export function throwTimeoutError(e, timeoutErrorInfo) { |
||||||
|
if ( |
||||||
|
[ |
||||||
|
'EHOSTDOWN', |
||||||
|
'ETIMEDOUT', |
||||||
|
'EHOSTUNREACH', |
||||||
|
'ENOTFOUND', |
||||||
|
'ECONNREFUSED', |
||||||
|
].includes(e.code) |
||||||
|
) { |
||||||
|
let db = ''; |
||||||
|
if (timeoutErrorInfo.connection.filename) { |
||||||
|
// for sqlite
|
||||||
|
db = timeoutErrorInfo.connection.filename; |
||||||
|
} else if ( |
||||||
|
timeoutErrorInfo.connection.database && |
||||||
|
timeoutErrorInfo.connection.host && |
||||||
|
timeoutErrorInfo.connection.port |
||||||
|
) { |
||||||
|
db = `${timeoutErrorInfo.connection.database} (${timeoutErrorInfo.connection.host}:${timeoutErrorInfo.connection.port})`; |
||||||
|
} |
||||||
|
throw new Error( |
||||||
|
`Failed to connect the database ${db} for Project ${timeoutErrorInfo.projectTitle}.
|
||||||
|
Please fix the connection issue or remove the project before trying to upgrade.` |
||||||
|
); |
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue