Exception: ThreeScale::Core::Error
- Inherits:
-
RuntimeError
- Object
- RuntimeError
- ThreeScale::Core::Error
show all
- Defined in:
- lib/3scale/core/errors.rb
Direct Known Subclasses
ApplicationHasInconsistentData, InvalidPerPage, InvalidProviderKeys, ProviderKeyExists, ProviderKeyNotFound, ServiceIsDefaultService, ServiceRequiresRegisteredUser, ServiceTokenMissingParameter, ServiceTokenRequiresServiceId, ServiceTokenRequiresToken, UsageLimitInvalidPeriods
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.code ⇒ Object
18
19
20
|
# File 'lib/3scale/core/errors.rb', line 18
def self.code
underscore(name[/[^:]*$/])
end
|
.underscore(string) ⇒ Object
TODO: move this over to some utility module.
23
24
25
26
27
28
|
# File 'lib/3scale/core/errors.rb', line 23
def self.underscore(string)
string.gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
gsub(/([a-z\d])([A-Z])/,'\1_\2').
downcase
end
|
Instance Method Details
#code ⇒ Object
14
15
16
|
# File 'lib/3scale/core/errors.rb', line 14
def code
self.class.code
end
|
#to_xml(options = {}) ⇒ Object
6
7
8
9
10
11
12
|
# File 'lib/3scale/core/errors.rb', line 6
def to_xml(options = {})
xml = Builder::XmlMarkup.new
xml.instruct! unless options[:skip_instruct]
xml.error(message, :code => code)
xml.target!
end
|