fixed up logger error to make it better to handle in code

This commit is contained in:
Bojan Kucera 2025-06-07 11:58:24 -04:00
parent db66687f48
commit d0bb4db042
18 changed files with 51 additions and 45 deletions

View file

@ -166,7 +166,7 @@ export class QuestDBSchemaManager {
await this.createTable(schema);
this.logger.info(`Table ${tableName} created successfully`);
} catch (error) {
this.logger.error(`Failed to create table ${tableName}`, { error });
this.logger.error(`Failed to create table ${tableName}`, error);
throw error;
}
}
@ -201,7 +201,7 @@ export class QuestDBSchemaManager {
await this.client.query(sql);
this.logger.info(`Table ${tableName} dropped`);
} catch (error) {
this.logger.error(`Failed to drop table ${tableName}`, { error });
this.logger.error(`Failed to drop table ${tableName}`, error);
throw error;
}
}
@ -219,7 +219,7 @@ export class QuestDBSchemaManager {
return result.rows.length > 0 && result.rows[0].count > 0;
} catch (error) {
this.logger.error(`Error checking if table exists: ${tableName}`, { error });
this.logger.error(`Error checking if table exists: ${tableName}`, error);
return false;
}
}
@ -260,7 +260,7 @@ export class QuestDBSchemaManager {
const stats = await this.getTableStats(tableName);
this.logger.info(`Table ${tableName} stats`, stats);
} catch (error) {
this.logger.error(`Failed to optimize table ${tableName}`, { error });
this.logger.error(`Failed to optimize table ${tableName}`, error);
throw error;
}
}
@ -280,7 +280,7 @@ export class QuestDBSchemaManager {
return result.rows[0] || {};
} catch (error) {
this.logger.error(`Failed to get table stats for ${tableName}`, { error });
this.logger.error(`Failed to get table stats for ${tableName}`, error);
throw error;
}
}
@ -293,7 +293,7 @@ export class QuestDBSchemaManager {
await this.client.query(`TRUNCATE TABLE ${tableName}`);
this.logger.info(`Table ${tableName} truncated`);
} catch (error) {
this.logger.error(`Failed to truncate table ${tableName}`, { error });
this.logger.error(`Failed to truncate table ${tableName}`, error);
throw error;
}
}