File tree Expand file tree Collapse file tree 2 files changed +16
-6
lines changed Expand file tree Collapse file tree 2 files changed +16
-6
lines changed Original file line number Diff line number Diff line change @@ -10,11 +10,5 @@ def import
10
10
developer_token = ask ( 'DEVELOPER_TOKEN:' )
11
11
EvernoteAuthorizer . new ( developer_token ) . import ( DEFAULT_OUTPUT_DIR )
12
12
end
13
-
14
- class << self
15
- def tell ( message )
16
- tell ( message )
17
- end
18
- end
19
13
end
20
14
end
Original file line number Diff line number Diff line change @@ -19,6 +19,8 @@ def initialize(developer_token)
19
19
note_store = Evernote ::EDAM ::NoteStore ::NoteStore ::Client . new ( note_store_protocol )
20
20
@developer_token = developer_token
21
21
@note_store = note_store
22
+ rescue => e
23
+ abort_with_message e
22
24
end
23
25
24
26
def fetch_notebook_list
@@ -52,6 +54,7 @@ def fetch_notes(filter)
52
54
# Download the all of notes fron Evernote and generate Boostnote storage from it
53
55
# TODO: move this method to CLI
54
56
def import ( output_dir )
57
+ puts 'processing...'
55
58
FileUtils . mkdir_p ( output_dir ) unless FileTest . exist? ( output_dir )
56
59
notebook_list = self . notebook_list
57
60
@@ -70,6 +73,19 @@ def import(output_dir)
70
73
end
71
74
end
72
75
end
76
+ puts 'Successfully finished!'
77
+ rescue => e
78
+ abort_with_message e
79
+ end
80
+
81
+ def abort_with_message ( exception )
82
+ if exception . class == Evernote ::EDAM ::Error ::EDAMUserException
83
+ abort "\e [31mError! Confirm your developer token\e [0m"
84
+ elsif exception . class == Evernote ::EDAM ::Error ::EDAMSystemException
85
+ abort "\e [31mError! You reached EvernoteAPI rate limitation\e [0m"
86
+ else
87
+ raise exception
88
+ end
73
89
end
74
90
end
75
91
end
You can’t perform that action at this time.
0 commit comments