Method: Sym::Application#execute

Defined in:
lib/sym/application.rb

#executeObject

Main action method — it looksup the command, and executes it, translating various exception conditions into meaningful error messages.



57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/sym/application.rb', line 57

def execute
  process_output(execute!)

rescue ::OpenSSL::Cipher::CipherError => e
  { reason:    'Invalid key provided',
    exception: e }

rescue Sym::Errors::Error => e
  { reason:    e.class.name.gsub(/.*::/, '').underscore.humanize.downcase,
    exception: e }

rescue TypeError => e
  if e.message =~ /marshal/m
    { reason:    'Corrupt source data or invalid/corrupt key provided',
      exception: e }
  else
    { exception: e }
  end

rescue StandardError => e
  { exception: e }
end