lib/timber/events/error.rb in timber-2.6.0.pre.beta1 vs lib/timber/events/error.rb in timber-2.6.0.pre.beta2
- old
+ new
@@ -14,11 +14,11 @@
attr_reader :name, :error_message, :backtrace
def initialize(attributes)
normalizer = Util::AttributeNormalizer.new(attributes)
@name = normalizer.fetch!(:name, :string)
- @error_message = normalizer.fetch!(:error_message, :string, :limit => MESSAGE_MAX_BYTES)
+ @error_message = normalizer.fetch(:error_message, :string, :limit => MESSAGE_MAX_BYTES)
@backtrace = normalizer.fetch(:backtrace, :array)
end
def to_hash
@to_hash ||= Util::NonNilHashBuilder.build do |h|
@@ -33,10 +33,16 @@
def as_json(_options = {})
{:error => to_hash}
end
def message
- "#{name} (#{error_message})"
+ message = "#{name}"
+
+ if !error_message.nil?
+ message << " (#{error_message})"
+ end
+
+ message
end
end
end
end
\ No newline at end of file