diff --git a/lib/syspro/logon.rb b/lib/syspro/logon.rb index eb0f1dc..2fddf00 100644 --- a/lib/syspro/logon.rb +++ b/lib/syspro/logon.rb @@ -10,6 +10,7 @@ module Syspro 'CompanyPassword' => company_password } resp = request(:get, resource_url, params) + handle_errors(resp) UserIdObject.new(resp[0].http_body) end @@ -17,6 +18,11 @@ module Syspro '/Logon' end + def handle_errors(resp) + body = resp[0].http_body + raise AuthenticationError, body if body =~ /^(ERROR)/ + end + UserIdObject = Struct.new(:guid) end end -- libgit2 0.21.4