Skip to content

Commit

Permalink
better error message handling
Browse files Browse the repository at this point in the history
  • Loading branch information
Watson1978 committed Feb 22, 2015
1 parent 551cf7b commit 83ce370
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions command/utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,16 +73,18 @@ def password

def parse_nslog_message(message)
messages = []
message.split("\n").each do |msg|
tmp = message.split("\n")
tmp.shift if tmp[0].end_with?("Error: (")
tmp.each do |msg|
msg.strip!
if m = msg.match(/(No errors.+)/)
# success
messages << m[1]
elsif m = msg.match(/^"Error Domain=[^"]+"(.+)\\" UserInfo=.+/)
elsif m = msg.match(/NSLocalizedDescription=(.+), NSLocalizedFailureReason=/)
# error
messages << m[1]
elsif m = msg.match(/(Error:.+)/)
# other errors (password error...)
# other errors
messages << m[1]
end
end
Expand Down

0 comments on commit 83ce370

Please sign in to comment.