From de28367ceb92bce8242905424d533bb724b43b94 Mon Sep 17 00:00:00 2001 From: Karl Prieb Date: Fri, 27 Sep 2024 16:28:39 -0300 Subject: [PATCH] fix error handling for helper methods --- src/workers/parquet-exporter.ts | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/workers/parquet-exporter.ts b/src/workers/parquet-exporter.ts index 5b07de2c..6c26ca84 100644 --- a/src/workers/parquet-exporter.ts +++ b/src/workers/parquet-exporter.ts @@ -485,8 +485,10 @@ export class ParquetExporter { minHeight: result[0].min_height, maxHeight: result[0].max_height, }; - } catch (error) { - throw `Error getting height range for ${tableName}: ${error}`; + } catch (error: any) { + const newError = new Error(`Error getting height range for ${tableName}`); + newError.stack = error.stack; + throw newError; } } @@ -504,8 +506,12 @@ export class ParquetExporter { const result = await this.db.all(query); return result[0].count; - } catch (error) { - throw `Error getting row count for height ${height} in ${tableName}: ${error}`; + } catch (error: any) { + const newError = new Error( + `Error getting row count for height ${height} in ${tableName}`, + ); + newError.stack = error.stack; + throw newError; } } }