exception_handling 1.2.0 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f7a5247d7f017803d5980c254bae1a598f8f6db3
4
- data.tar.gz: 12edf7f3951cc443f5827c81f4f3e101b7b68c62
3
+ metadata.gz: b1a9a9df6c3ca8dd4f61b7e35f62271deec138d9
4
+ data.tar.gz: 8fb61925651d34146c4d86394f4ebb638d45032c
5
5
  SHA512:
6
- metadata.gz: 93c6a4c4452b9523556b5e24623fff2879978cf022c371d45acb537ab7fd6570200d56b0bc95edd412aa1704f0c33ebdf8a256a44c65e3d415e8edffcbfc0098
7
- data.tar.gz: d018fbb57661e0bcc1c064378640f750eabbfd0218e5b306f55f9b69bc0fbf239bf2f164542d97c2e5926ac3829f29f76cb491aadc695ba62f21544bf0d0aa33
6
+ metadata.gz: d43b9121fbffa0b17b2b9ac117d719a8409300c956eb961624e5550dc908b7f6aae0697a7e196ad95d4f9308bbfd137f8dbd0fa937e2f4d316809c9dbf452be3
7
+ data.tar.gz: 6be898b1d470b87e43e5164954ad2e51e68b6bf01477677da1df75bd50781303e56b14587734162844ebdc4320b70a6732a5e0f475ca0add816911d9b46f19a3
@@ -247,7 +247,7 @@ EOF
247
247
  #
248
248
  def write_exception_to_log(ex, exception_context, timestamp)
249
249
  ActiveSupport::Deprecation.silence do
250
- ExceptionHandling.logger.fatal("\n(Error:#{timestamp}) #{ex.class} #{exception_context} (#{ex.message}):\n " + clean_backtrace(ex).join("\n ") + "\n\n")
250
+ ExceptionHandling.logger.fatal("\n(Error:#{timestamp}) #{ex.class} #{exception_context} (#{encode_utf8(ex.message)}):\n " + clean_backtrace(ex).join("\n ") + "\n\n")
251
251
  end
252
252
  end
253
253
 
@@ -255,7 +255,7 @@ EOF
255
255
  # Log exception to honeybadger.io.
256
256
  #
257
257
  def send_exception_to_honeybadger(ex, exception_context, timestamp)
258
- custom_message = "(Error:#{timestamp}) #{ex.class} #{exception_context} (#{ex.message}): " + clean_backtrace(ex).join(" ")
258
+ custom_message = "(Error:#{timestamp}) #{ex.class} #{exception_context} (#{encode_utf8(ex.message)}): " + clean_backtrace(ex).join(" ")
259
259
  Honeybadger.notify(ex, context: { custom_message: custom_message })
260
260
  end
261
261
 
@@ -336,7 +336,7 @@ EOF
336
336
  ex = make_exception(exception_or_string)
337
337
  log_error(ex, exception_context)
338
338
  begin
339
- ExceptionHandling::Sensu.generate_event(alert_name, exception_context.to_s + "\n" + ex.message.to_s)
339
+ ExceptionHandling::Sensu.generate_event(alert_name, exception_context.to_s + "\n" + encode_utf8(ex.message.to_s))
340
340
  rescue => send_ex
341
341
  log_error(send_ex, 'ExceptionHandling.alert_warning')
342
342
  end
@@ -383,7 +383,7 @@ EOF
383
383
  ExceptionHandling.custom_data_hook.call(data)
384
384
  rescue Exception => ex
385
385
  # can't call log_error here or we will blow the call stack
386
- log_info( "Unable to execute custom custom_data_hook callback. #{ex.message} #{ex.backtrace.each {|l| "#{l}\n"}}" )
386
+ log_info( "Unable to execute custom custom_data_hook callback. #{encode_utf8(ex.message)} #{ex.backtrace.each {|l| "#{l}\n"}}" )
387
387
  end
388
388
  end
389
389
 
@@ -417,7 +417,7 @@ EOF
417
417
  ExceptionHandling.post_log_error_hook.call(exception_data, exception)
418
418
  rescue Exception => ex
419
419
  # can't call log_error here or we will blow the call stack
420
- log_info( "Unable to execute custom log_error callback. #{ex.message} #{ex.backtrace.each {|l| "#{l}\n"}}" )
420
+ log_info( "Unable to execute custom log_error callback. #{encode_utf8(ex.message)} #{ex.backtrace.each {|l| "#{l}\n"}}" )
421
421
  end
422
422
  end
423
423
 
@@ -598,13 +598,13 @@ EOF
598
598
  def exception_to_data( exception, exception_context, timestamp )
599
599
  data = ActiveSupport::HashWithIndifferentAccess.new
600
600
  data[:error_class] = exception.class.name
601
- data[:error_string]= "#{data[:error_class]}: #{exception.message}"
601
+ data[:error_string]= "#{data[:error_class]}: #{encode_utf8(exception.message)}"
602
602
  data[:timestamp] = timestamp
603
603
  data[:backtrace] = clean_backtrace(exception)
604
604
  if exception_context && exception_context.is_a?(Hash)
605
605
  # if we are a hash, then we got called from the DebugExceptions rack middleware filter
606
606
  # and we need to do some things different to get the info we want
607
- data[:error] = "#{data[:error_class]}: #{exception.message}"
607
+ data[:error] = "#{data[:error_class]}: #{encode_utf8(exception.message)}"
608
608
  data[:session] = exception_context['rack.session']
609
609
  data[:environment] = exception_context
610
610
  else
@@ -641,5 +641,12 @@ EOF
641
641
  end unless h.nil?
642
642
  result
643
643
  end
644
+
645
+ def encode_utf8(string)
646
+ string.encode('UTF-8',
647
+ replace: '?',
648
+ undef: :replace,
649
+ invalid: :replace)
650
+ end
644
651
  end
645
652
  end
@@ -1,3 +1,3 @@
1
1
  module ExceptionHandling
2
- VERSION = "1.2.0"
2
+ VERSION = "1.2.1"
3
3
  end
@@ -0,0 +1,3 @@
1
+ #!/bin/sh -x
2
+
3
+ bundle install --path vendor/bundle
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: exception_handling
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Colin Kelley
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-18 00:00:00.000000000 Z
11
+ date: 2016-03-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: eventmachine
@@ -175,6 +175,7 @@ files:
175
175
  - lib/exception_handling/sensu.rb
176
176
  - lib/exception_handling/testing.rb
177
177
  - lib/exception_handling/version.rb
178
+ - semaphore_ci/setup.sh
178
179
  - test/test_helper.rb
179
180
  - test/unit/exception_handling/exception_catalog_test.rb
180
181
  - test/unit/exception_handling/exception_description_test.rb