From 5feaff130f8339b1194f9cb29445c22fa998df61 Mon Sep 17 00:00:00 2001 From: softsimon Date: Wed, 28 Oct 2020 11:00:48 +0700 Subject: [PATCH] Adding missing error cause messages. --- backend/src/api/backend-info.ts | 2 +- backend/src/api/bisq/bisq.ts | 2 +- backend/src/api/bisq/markets.ts | 2 +- backend/src/api/disk-cache.ts | 2 +- backend/src/api/donations.ts | 8 ++++---- backend/src/api/statistics.ts | 7 ++++--- backend/src/api/websocket-handler.ts | 2 +- backend/src/database.ts | 2 +- 8 files changed, 14 insertions(+), 13 deletions(-) diff --git a/backend/src/api/backend-info.ts b/backend/src/api/backend-info.ts index 776ea1737..eb3f1f664 100644 --- a/backend/src/api/backend-info.ts +++ b/backend/src/api/backend-info.ts @@ -26,7 +26,7 @@ class BackendInfo { try { this.gitCommitHash = fs.readFileSync('../.git/refs/heads/master').toString().trim(); } catch (e) { - logger.err('Could not load git commit info, skipping.'); + logger.err('Could not load git commit info: ' + e.message || e); } } } diff --git a/backend/src/api/bisq/bisq.ts b/backend/src/api/bisq/bisq.ts index 312837dbd..bf43851f6 100644 --- a/backend/src/api/bisq/bisq.ts +++ b/backend/src/api/bisq/bisq.ts @@ -160,7 +160,7 @@ class Bisq { this.buildIndex(); this.calculateStats(); } catch (e) { - logger.err('loadBisqDumpFile() error.' + e.message); + logger.err('loadBisqDumpFile() error.' + e.message || e); } } diff --git a/backend/src/api/bisq/markets.ts b/backend/src/api/bisq/markets.ts index ed8b05592..a209a055c 100644 --- a/backend/src/api/bisq/markets.ts +++ b/backend/src/api/bisq/markets.ts @@ -98,7 +98,7 @@ class Bisq { logger.debug('Bisq market data updated in ' + time + ' ms'); } } catch (e) { - logger.err('loadBisqMarketDataDumpFile() error.' + e.message); + logger.err('loadBisqMarketDataDumpFile() error.' + e.message || e); } } diff --git a/backend/src/api/disk-cache.ts b/backend/src/api/disk-cache.ts index 591f1c97e..58935e508 100644 --- a/backend/src/api/disk-cache.ts +++ b/backend/src/api/disk-cache.ts @@ -41,7 +41,7 @@ class DiskCache { })); logger.debug('Mempool and blocks data saved to disk cache'); } catch (e) { - logger.warn('Error writing to cache file asynchronously'); + logger.warn('Error writing to cache file asynchronously: ' + e.message || e); } } diff --git a/backend/src/api/donations.ts b/backend/src/api/donations.ts index ae410520f..b8462df5a 100644 --- a/backend/src/api/donations.ts +++ b/backend/src/api/donations.ts @@ -110,7 +110,7 @@ class Donations { connection.release(); return rows; } catch (e) { - logger.err('$getDonationsFromDatabase() error' + e); + logger.err('$getDonationsFromDatabase() error: ' + e.message || e); return []; } } @@ -123,7 +123,7 @@ class Donations { connection.release(); return rows; } catch (e) { - logger.err('$getLegacyDonations() error' + e); + logger.err('$getLegacyDonations() error' + e.message || e); return []; } } @@ -159,7 +159,7 @@ class Donations { const [result]: any = await connection.query(query, params); connection.release(); } catch (e) { - logger.err('$addDonationToDatabase() error' + e); + logger.err('$addDonationToDatabase() error' + e.message || e); } } @@ -177,7 +177,7 @@ class Donations { const [result]: any = await connection.query(query, params); connection.release(); } catch (e) { - logger.err('$updateDonation() error' + e); + logger.err('$updateDonation() error' + e.message || e); } } diff --git a/backend/src/api/statistics.ts b/backend/src/api/statistics.ts index 75274d90c..ebdd85a9b 100644 --- a/backend/src/api/statistics.ts +++ b/backend/src/api/statistics.ts @@ -234,7 +234,7 @@ class Statistics { connection.release(); return result.insertId; } catch (e) { - logger.err('$create() error' + e); + logger.err('$create() error' + e.message || e); } } @@ -292,7 +292,7 @@ class Statistics { return this.mapStatisticToOptimizedStatistic([rows[0]])[0]; } } catch (e) { - logger.err('$list2H() error' + e); + logger.err('$list2H() error' + e.message || e); } } @@ -304,7 +304,7 @@ class Statistics { connection.release(); return this.mapStatisticToOptimizedStatistic(rows); } catch (e) { - logger.err('$list2H() error' + e); + logger.err('$list2H() error' + e.message || e); return []; } } @@ -317,6 +317,7 @@ class Statistics { connection.release(); return this.mapStatisticToOptimizedStatistic(rows); } catch (e) { + logger.err('$list24h() error' + e.message || e); return []; } } diff --git a/backend/src/api/websocket-handler.ts b/backend/src/api/websocket-handler.ts index 753d3d33a..fdaaf0ee1 100644 --- a/backend/src/api/websocket-handler.ts +++ b/backend/src/api/websocket-handler.ts @@ -107,7 +107,7 @@ class WebsocketHandler { client.send(JSON.stringify(response)); } } catch (e) { - logger.err('Error parsing websocket message: ' + e); + logger.err('Error parsing websocket message: ' + e.message || e); } }); }); diff --git a/backend/src/database.ts b/backend/src/database.ts index 213bf6fb5..f288fcfa3 100644 --- a/backend/src/database.ts +++ b/backend/src/database.ts @@ -20,7 +20,7 @@ export async function checkDbConnection() { logger.info('Database connection established.'); connection.release(); } catch (e) { - logger.err('Could not connect to database.'); + logger.err('Could not connect to database: ' + e.message || e); process.exit(1); } }