From d2edfc737d210256013bfe001524743e8d3d1060 Mon Sep 17 00:00:00 2001 From: Isaac Lewis Date: Mon, 14 May 2018 13:06:37 -0700 Subject: [PATCH] handle logon errors --- lib/syspro/logon.rb | 6 ++++++ 1 file changed, 6 insertions(+), 0 deletions(-) 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