File tree 2 files changed +9
-1
lines changed
2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change 1
1
'use strict' ;
2
2
3
+ const AlreadyRanError = require ( './src/error/alreadyRan' ) ;
3
4
const { exec } = require ( 'child_process' ) ;
4
5
const fs = require ( 'fs' ) ;
5
6
const migrationSchema = require ( './src/schemas/migrationSchema' ) ;
@@ -15,6 +16,8 @@ let didInit = false;
15
16
16
17
exports . models = { Migration : null , Operation : null } ;
17
18
19
+ exports . AlreadyRanError = AlreadyRanError ;
20
+
18
21
const writeOps = [
19
22
// Update
20
23
'findOneAndReplace' ,
@@ -196,7 +199,7 @@ exports.startMigration = async function startMigration(options) {
196
199
197
200
const existingMigration = await Migration . exists ( { name } ) ;
198
201
if ( existingMigration ) {
199
- throw new Error ( `Migration "${ name } " already ran` ) ;
202
+ throw new AlreadyRanError ( `Migration "${ name } " already ran` ) ;
200
203
}
201
204
202
205
const sourceCode = await new Promise ( resolve => {
Original file line number Diff line number Diff line change
1
+ 'use strict' ;
2
+
3
+ class AlreadyRanError extends Error { }
4
+
5
+ module . exports = AlreadyRanError ;
You can’t perform that action at this time.
0 commit comments