azure-armrest 0.2.8 → 0.2.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES +3 -0
- data/lib/azure/armrest/exception.rb +25 -2
- data/lib/azure/armrest/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f3198a7b942784b49438efa209642a348299d234
|
4
|
+
data.tar.gz: e0512f7d077f2987e6ae1bc740871747bf8985fb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 455068f550d8ba2048788cee68ed2064d11e89b1a86c72b04cc02840b56b2b8c274cc7365d0c6c8c23943006634a7fc3bf7860288db1aabc351c01df8dff39b3
|
7
|
+
data.tar.gz: 7e546e34a28f6457e2a909ad1597160fad83dd45651fa0b93bcc14fc66f7263fa65e26c410b7c6540f4cf71d56ea56f975a4db8e6e2cf2bc55ec047b72141365
|
data/CHANGES
CHANGED
@@ -4,15 +4,30 @@ module Azure
|
|
4
4
|
attr_accessor :cause
|
5
5
|
attr_writer :message
|
6
6
|
|
7
|
+
# Create a new Armrest::Exception object. The +message+ should be an
|
8
|
+
# error string, while +cause_exception+ is typically set to the
|
9
|
+
# raw RestClient exception.
|
10
|
+
#
|
11
|
+
# You will not typically use this object directly.
|
12
|
+
#
|
7
13
|
def initialize(message = nil, cause_exception = nil)
|
8
14
|
@message = message
|
9
15
|
@cause = cause_exception
|
10
16
|
end
|
11
17
|
|
18
|
+
# The stringified version (message) of the exception.
|
19
|
+
#
|
12
20
|
def to_s
|
13
|
-
|
21
|
+
if cause
|
22
|
+
"#{message} (cause: #{cause})"
|
23
|
+
else
|
24
|
+
message
|
25
|
+
end
|
14
26
|
end
|
15
27
|
|
28
|
+
# The error message or, if the message is not set, the name of the
|
29
|
+
# exception class.
|
30
|
+
#
|
16
31
|
def message
|
17
32
|
@message || self.class.name
|
18
33
|
end
|
@@ -21,16 +36,24 @@ module Azure
|
|
21
36
|
class ApiException < Exception
|
22
37
|
attr_accessor :code
|
23
38
|
|
39
|
+
# Create a new ApiException class. The +code+ is the error code.
|
40
|
+
#
|
41
|
+
# This class serves as the parent
|
24
42
|
def initialize(code, message, cause_exception)
|
25
43
|
@code = code
|
26
44
|
super(message, cause_exception)
|
27
45
|
end
|
28
46
|
|
47
|
+
# A stringified version of the error. If self is a plain ApiException,
|
48
|
+
# then the cause is included to aid in debugging.
|
49
|
+
#
|
29
50
|
def to_s
|
30
|
-
"[#{code}] #{
|
51
|
+
"[#{code}] #{super}"
|
31
52
|
end
|
32
53
|
end
|
33
54
|
|
55
|
+
# A list of predefined exceptions that we wrap around RestClient exceptions.
|
56
|
+
|
34
57
|
class ResourceNotFoundException < ApiException; end
|
35
58
|
|
36
59
|
class BadRequestException < ApiException; end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: azure-armrest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel J. Berger
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2016-
|
14
|
+
date: 2016-08-25 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: json
|