File tree Expand file tree Collapse file tree 2 files changed +6
-4
lines changed
Expand file tree Collapse file tree 2 files changed +6
-4
lines changed Original file line number Diff line number Diff line change 11{
22 "name" : " igdm" ,
3- "version" : " 1.3.2 " ,
3+ "version" : " 1.3.3 " ,
44 "description" : " Send and receive Instagram direct message through CLI." ,
55 "keywords" : [
66 " instagram" ,
Original file line number Diff line number Diff line change @@ -7,15 +7,15 @@ import chalk from 'chalk';
77const prefix = chalk . blue ( '?' ) ;
88
99export default class Authenticator {
10- private sessionPath : string = resolve ( process . mainModule ! . path , '..' , 'session.json' )
10+ private sessionPath : string = resolve ( require . main ! . path , '..' , 'session.json' )
1111
1212 private saveSession ( data : object ) {
1313 writeFileSync ( this . sessionPath , JSON . stringify ( data ) ) ;
1414 }
1515
1616 private get sessionExists ( ) : boolean {
1717 const session = readFileSync ( this . sessionPath , { encoding : 'utf-8' } ) ;
18- if ( JSON . stringify ( session ) === '"{}" ' ) return false ;
18+ if ( session === '{} ' ) return false ;
1919
2020 const cookies : { cookies : { key : string } [ ] } = JSON . parse ( this . loadSession ( ) . cookies ) ;
2121
@@ -73,8 +73,10 @@ export default class Authenticator {
7373 } )
7474 . then ( ( ) => ig )
7575 . catch ( ( ) => {
76+ const error = chalk . red . bold ( 'An error occurred while logging in. Check your credentials or your network connectivity.' ) ;
77+ console . error ( error ) ;
7678 this . logout ( ) ;
77- throw new Error ( 'An error occurred while logging in.' ) ;
79+ throw new Error ( error )
7880 } ) ;
7981 }
8082
You can’t perform that action at this time.
0 commit comments