lib/heartcheck/checks/base.rb in heartcheck-1.3.0 vs lib/heartcheck/checks/base.rb in heartcheck-1.4.0
- old
+ new
@@ -28,10 +28,17 @@
# If it is 0 the timeout will be disable
#
# @return [Integer] (default: 0)
attr_accessor :timeout
+ # An url to provide more info about the check.
+ # It is important to provide details about the failure, for example:
+ # - what is the impact
+ # - how to fix it
+ # - how to reproduce the failure
+ # @return [String] (default: nil)
+ attr_accessor :doc_url
# Create a new instance and set the default values.
#
# @return [Check]
def initialize
@@ -186,10 +193,14 @@
# # => {type: 'error', message: 'some string'}
#
# @return [Hash]
def format_error
lambda do |error|
- error.is_a?(Hash) ? error : { type: 'error', message: error }
+ if error.is_a?(Hash)
+ error
+ else
+ { type: 'error', message: error, doc_url: doc_url }
+ end
end
end
end
end
end