refactor(mikrotikBackupRoutes, mikrotikApplyService): improve error handling and logging for backup and file retrieval processes
Publish Fast Tabler Docker image / build-and-push-fast (push) Successful in 3m2s
Publish Fast Tabler Docker image / build-and-push-fast (push) Successful in 3m2s
This commit is contained in:
@@ -280,9 +280,16 @@ async function runBackupNow(req, res) {
|
||||
s3,
|
||||
});
|
||||
} catch (error) {
|
||||
console.error('runBackupNow error:', error);
|
||||
const msg = error?.message || 'Error running backup now';
|
||||
return sendError(res, 500, msg, 'E_BACKUP_RUN');
|
||||
console.error('runBackupNow error:', error?.message, error?.stack, error?.response?.data);
|
||||
let msg = error?.message || 'Error running backup now';
|
||||
const detail = error?.response?.data;
|
||||
if (detail && typeof detail === 'object') {
|
||||
const d = detail.detail || detail.message;
|
||||
if (d) msg += ` (${d})`;
|
||||
} else if (typeof detail === 'string') {
|
||||
msg += ` (${detail})`;
|
||||
}
|
||||
return sendError(res, 500, msg, 'E_BACKUP_RUN', process.env.NODE_ENV !== 'production' ? { stack: error?.stack } : undefined);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user