File tree Expand file tree Collapse file tree 3 files changed +20
-2
lines changed
Expand file tree Collapse file tree 3 files changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ const program = require('commander');
44const Config = require ( './include/file-config' ) ;
55const Cli = require ( './include/cli' ) ;
66const Tasks = require ( './include/tasks' ) ;
7+ const Owner = require ( './models/owner' ) ;
78
89program
910 . option ( '-p --proxy <proxy>' , 'use a proxy server with the given url' )
@@ -16,10 +17,13 @@ Cli.verbose = program.verbose;
1617let config = new Config ( process . cwd ( ) )
1718 . set ( 'proxy' , program . proxy )
1819 . set ( '_checkToken' , program . check_token ) ,
19- tasks = new Tasks ( config ) ;
20+ tasks = new Tasks ( config ) ,
21+ owner = new Owner ( config ) ;
2022
2123tasks . syncInit ( )
2224 . then ( ( ) => tasks . sync . frames . length === 0 ? process . exit ( 0 ) : null )
25+ . then ( ( ) => owner . authorized ( ) )
26+ . catch ( e => Cli . x ( `Invalid access token!` , e ) )
2327 . then ( ( ) => {
2428 Cli . bar ( `${ Cli . fetch } Fetching or creating issues & merge requests...` , tasks . sync . frames . length ) ;
2529 return tasks . syncResolve ( Cli . advance ) ;
Original file line number Diff line number Diff line change @@ -34,6 +34,7 @@ class frame {
3434 frame . _stop = json . stop ;
3535 frame . notes = json . notes ;
3636 frame . timezone = json . timezone ;
37+ frame . validate ( ) ;
3738
3839 return frame ;
3940 }
@@ -56,6 +57,18 @@ class frame {
5657 return this ;
5758 }
5859
60+ validate ( ) {
61+ moment . suppressDeprecationWarnings = true ;
62+
63+ if ( ! moment ( this . _start ) . isValid ( ) )
64+ throw `Error: Start date is not in a valid ISO date format!` ;
65+
66+ if ( ! moment ( this . _stop ) . isValid ( ) )
67+ throw `Error: Stop date is not in a valid ISO date format!` ;
68+
69+ moment . suppressDeprecationWarnings = false ;
70+ }
71+
5972 _getCurrentDate ( ) {
6073 if ( this . timezone )
6174 return moment ( ) . tz ( this . timezone ) . format ( ) ;
Original file line number Diff line number Diff line change @@ -12,7 +12,8 @@ class frameCollection extends Base {
1212 try {
1313 return Frame . fromFile ( this . config , Fs . join ( this . config . frameDir , file ) ) ;
1414 } catch ( e ) {
15- return false ;
15+ console . log ( e ) ;
16+ throw `Error parsing frame file: ${ file } `
1617 }
1718 } )
1819 . filter ( frame => frame ) ;
You can’t perform that action at this time.
0 commit comments