mirror of
https://gitee.com/nocobase/nocobase.git
synced 2024-12-02 12:18:15 +08:00
chore: application start error message (#4477)
This commit is contained in:
parent
cece85b335
commit
bbbb409565
@ -801,7 +801,7 @@ export class Database extends EventEmitter implements AsyncEmitter {
|
||||
|
||||
/* istanbul ignore next -- @preserve */
|
||||
async auth(options: Omit<QueryOptions, 'retry'> & { retry?: number | Pick<QueryOptions, 'retry'> } = {}) {
|
||||
const { retry = 10, ...others } = options;
|
||||
const { retry = 5, ...others } = options;
|
||||
const startingDelay = 50;
|
||||
const timeMultiple = 2;
|
||||
|
||||
@ -831,7 +831,7 @@ export class Database extends EventEmitter implements AsyncEmitter {
|
||||
timeMultiple: timeMultiple,
|
||||
});
|
||||
} catch (error) {
|
||||
throw new Error('Connection failed, please check your database connection credentials and try again.');
|
||||
throw new Error(`Unable to connect to the database`, { cause: error });
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -34,8 +34,20 @@ export const errors: AppErrors = {
|
||||
APP_ERROR: {
|
||||
status: 503,
|
||||
message: ({ app }) => {
|
||||
return AppSupervisor.getInstance().appErrors[app.name]?.message;
|
||||
const error = AppSupervisor.getInstance().appErrors[app.name];
|
||||
if (!error) {
|
||||
return '';
|
||||
}
|
||||
|
||||
let message = error.message;
|
||||
|
||||
if ((error as any).cause) {
|
||||
message = `${message}: ${(error as any).cause.message}`;
|
||||
}
|
||||
|
||||
return message;
|
||||
},
|
||||
|
||||
code: ({ app }): string => {
|
||||
const error = AppSupervisor.getInstance().appErrors[app.name];
|
||||
return error['code'] || 'APP_ERROR';
|
||||
|
Loading…
Reference in New Issue
Block a user