cortex-exceptions 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/cortex/exceptions.rb +11 -3
- data/lib/cortex/exceptions/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 25e9e5e1527cb16da3d331d52b3a1a652380b6ec
|
4
|
+
data.tar.gz: 651b2f1f517cda27504bccca0eb5a71f471557d8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0191b17111ccb561406eaca6438710e331c604d41681855e5a1ac0ae957794dcc751fd5b9d965d5a10b6c1cce31c7fac6b9cf417ec45d471ed095a8c2ddfb76e
|
7
|
+
data.tar.gz: 5cfd5aec66ba30771d9a2345176b7a535fb988b518cff3a8094c9fe29948e3d5579bd3503482e298c9657a2346b175b865cd8e2fce3280c4b37e1e40a053fcd4
|
data/lib/cortex/exceptions.rb
CHANGED
@@ -4,7 +4,7 @@ module Cortex
|
|
4
4
|
module Exceptions
|
5
5
|
class CortexError < StandardError; end
|
6
6
|
|
7
|
-
class
|
7
|
+
class ApiError < CortexError
|
8
8
|
attr_accessor :http_status
|
9
9
|
|
10
10
|
def initialize(message = 'Internal server error', http_status = :internal_server_error)
|
@@ -13,18 +13,26 @@ module Cortex
|
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
16
|
-
class NotEmptyError <
|
16
|
+
class NotEmptyError < ApiError
|
17
17
|
def initialize(message = nil)
|
18
18
|
super(message, :conflict)
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
|
-
class ResourceConsumed <
|
22
|
+
class ResourceConsumed < ApiError
|
23
23
|
def initialize(message = 'Resource is in use by another resource and cannot be deleted', http_status = :unprocessable_entity)
|
24
24
|
super(message)
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
|
+
class ConnectionFailed < APIError
|
29
|
+
attr_reader :base_url
|
30
|
+
def initialize(base_url = "http://api.cbcortex.com/api/v1/", message = nil, http_status = 599)
|
31
|
+
@base_url = base_url
|
32
|
+
super(message: message, http_status: http_status)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
28
36
|
class IdExpected < ArgumentError; end
|
29
37
|
|
30
38
|
class IdNotExpected < ArgumentError; end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cortex-exceptions
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Talent Development
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-01-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -90,7 +90,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
90
90
|
version: '0'
|
91
91
|
requirements: []
|
92
92
|
rubyforge_project:
|
93
|
-
rubygems_version: 2.
|
93
|
+
rubygems_version: 2.4.5
|
94
94
|
signing_key:
|
95
95
|
specification_version: 4
|
96
96
|
summary: Common exceptions used across the Cortex SOA infrastructure.
|