Commit 7d46a01e6994deeed94dc358fce960bfe419e2fb
1 parent
0e38c117
handle errors refactor
Showing
7 changed files
with
6 additions
and
30 deletions
Show diff stats
lib/syspro/api_resource.rb
| ... | ... | @@ -18,6 +18,12 @@ module Syspro |
| 18 | 18 | "/#{CGI.escape(class_name.downcase)}" |
| 19 | 19 | end |
| 20 | 20 | |
| 21 | + def handle_errors(resp) | |
| 22 | + body = resp[0].http_body | |
| 23 | + raise AuthenticationError, body if body =~ /^(ERROR: The supplied UserID is invalid.)/ | |
| 24 | + raise SysproError, body if body =~ /^(ERROR)/ | |
| 25 | + end | |
| 26 | + | |
| 21 | 27 | def refresh |
| 22 | 28 | resp, opts = request(:get, resource_url, @retrieve_params) |
| 23 | 29 | initialize_from(resp.data, opts) | ... | ... |
lib/syspro/business_objects/combrw.rb
lib/syspro/business_objects/comfch.rb
lib/syspro/business_objects/comfnd.rb
lib/syspro/business_objects/porqry.rb
lib/syspro/business_objects/portor.rb
lib/syspro/business_objects/sorqry.rb