@@ -19,7 +19,6 @@ import {
1919 getBlockHeight ,
2020 getDBEnvVars ,
2121 hasLocalPostgres ,
22- isLinux ,
2322 printUsingConfig ,
2423 runSQL ,
2524} from '../shared/misc' ;
@@ -36,7 +35,6 @@ import { nodeStart } from './start';
3635
3736export type TOptions = IConfig & INetwork & IVerbose ;
3837
39- // TODO allow re-using an existing backup file
4038export default leaf ( {
4139 commandName : 'export-snapshot' ,
4240 description : `Creates an optimized database snapshot using the provided config and places it in ./${ BACKUPS_DIR } .` ,
@@ -45,6 +43,7 @@ export default leaf({
4543 ...configOption ,
4644 ...networkOption ,
4745 ...verboseOption ,
46+ // TODO --file options, which points to backup (to avoid exporting the db)
4847 } ,
4948
5049 async action ( { config, network, verbose } : TOptions ) {
@@ -116,7 +115,6 @@ export async function nodeExportSnapshot({
116115
117116 // TODO merge with `nodeImportDB()`
118117 // import the exported file
119- log ( 'Importing the backup file...' ) ;
120118 // TODO unify with others by piping manually
121119 const backupPath = path . resolve ( getBackupsDir ( ) , 'latest' ) ;
122120 try {
@@ -128,6 +126,7 @@ export async function nodeExportSnapshot({
128126 execSyncAsUser ( cmd , null , { env } ) ;
129127 } catch ( e ) {
130128 log ( `Cannot import "${ backupPath } " into the snap DB` ) ;
129+ throw e ;
131130 }
132131 await runSQL ( 'delete from exceptions;' , network , config , verbose , targetDB ) ;
133132
@@ -167,6 +166,7 @@ export async function nodeExportSnapshot({
167166 execSyncAsUser ( cmd , null , { env } ) ;
168167 } catch ( e ) {
169168 log ( "Couldn't dump the DB" ) ;
169+ throw e ;
170170 }
171171
172172 log ( 'Snapshot ready, removing the temp DB' ) ;
0 commit comments