diff --git a/packages/core/@types/source-module.ts b/packages/core/@types/source-module.ts index d56f422..7b083bf 100644 --- a/packages/core/@types/source-module.ts +++ b/packages/core/@types/source-module.ts @@ -30,7 +30,7 @@ export abstract class SourceModule { await this.cleanup(); } catch (error) { - console.log(`Error detected, reverting to previous state...`); + console.log('Error detected, reverting to previous state...'); await Promise.all( this.options.targets.map(async (target) => { @@ -39,6 +39,8 @@ export abstract class SourceModule { ); await this.revert(); + + throw error; } } diff --git a/packages/core/index.ts b/packages/core/index.ts index ce1f330..e920889 100644 --- a/packages/core/index.ts +++ b/packages/core/index.ts @@ -1,11 +1,16 @@ import { SourceModule } from './@types/source-module'; export async function Refreshly(...sources: SourceModule[]) { - await Promise.all( - sources.map(async (source) => { - await source.exec(); - }) - ); + try { + await Promise.all( + sources.map(async (source) => { + await source.exec(); + }) + ); + } catch (error) { + console.error(error); + process.exit(1); + } } // This is temporary