-
Notifications
You must be signed in to change notification settings - Fork 8
/
errors.rb
49 lines (44 loc) · 1.58 KB
/
errors.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
module SUSE
module Connect
class MalformedSccCredentialsFile < StandardError; end
class MissingSccCredentialsFile < StandardError; end
class FileError < StandardError; end
class CannotBuildBasicAuth < StandardError; end
class CannotBuildTokenAuth < StandardError; end
class TokenNotPresent < StandardError; end
class CannotDetectBaseProduct < StandardError; end
class SystemCallError < StandardError; end
class UnsupportedStatusFormat < StandardError; end
class NetworkError < StandardError; end
class SystemNotRegisteredError < StandardError; end
class BaseProductDeactivationError < StandardError; end
# Basic error for API interactions. Collects HTTP response (which includes
# status code and response body) for future showing to user via {Cli}
#
# Used by YaST already, do not refactor without consulting them!
# (Error handling: #response, #code, #message, #service)
class ApiError < StandardError
attr_accessor :response, :message
# @param response [Net::HTTPResponse] the HTTP response error returned
# by API request
def initialize(response)
@response = response
end
def code
@response.code
end
def message
@response.body['localized_error']
end
end
# Error for interactions with zypper. Collects process exit status for
# later reporting
class ZypperError < StandardError
attr_accessor :exitstatus, :output
def initialize(exitstatus, output)
@exitstatus = exitstatus
@output = output
end
end
end
end