diff --git a/shard.yml b/shard.yml index 84e21a0..05a6b8b 100644 --- a/shard.yml +++ b/shard.yml @@ -1,5 +1,5 @@ name: raven -version: 1.7.1 +version: 1.7.2 authors: - Sijawusz Pur Rahnama diff --git a/src/raven/breadcrumb_buffer.cr b/src/raven/breadcrumb_buffer.cr index 572ab75..b676550 100644 --- a/src/raven/breadcrumb_buffer.cr +++ b/src/raven/breadcrumb_buffer.cr @@ -57,7 +57,7 @@ module Raven end def empty? - !members.any? + members.empty? end def to_hash diff --git a/src/raven/integrations/kemal/log_handler.cr b/src/raven/integrations/kemal/log_handler.cr index d4ebb36..140d284 100644 --- a/src/raven/integrations/kemal/log_handler.cr +++ b/src/raven/integrations/kemal/log_handler.cr @@ -41,7 +41,7 @@ module Raven elapsed = Time.monotonic - time Raven.breadcrumbs.record do |crumb| - unless (200...400).includes? context.response.status_code + unless context.response.status_code.in?(100...400) crumb.level = :error end crumb.type = :http @@ -54,16 +54,15 @@ module Raven } end end - context end end def write(message) if log_messages? - Raven.breadcrumbs.record do |crumb| - crumb.category = "kemal" - crumb.message = message.strip - end + Raven.breadcrumbs.record( + category: "kemal", + message: message.strip + ) end @wrapped.try &.write(message) end diff --git a/src/raven/integrations/shared/user_feedback_handler.cr b/src/raven/integrations/shared/user_feedback_handler.cr index 405690a..a74808b 100644 --- a/src/raven/integrations/shared/user_feedback_handler.cr +++ b/src/raven/integrations/shared/user_feedback_handler.cr @@ -5,8 +5,15 @@ module Raven rescue ex raise ex unless Raven.configuration.capture_allowed?(ex) context.response.tap do |response| - response.status_code = 500 + if response.closed? + Log.warn { + "Couldn't render user feedback view because the response has already been closed" + } + next + end + response.status = :internal_server_error response.print render_view(ex) + response.close end context end diff --git a/src/raven/processors/http_headers.cr b/src/raven/processors/http_headers.cr index 044c68f..21fff1e 100644 --- a/src/raven/processors/http_headers.cr +++ b/src/raven/processors/http_headers.cr @@ -5,7 +5,7 @@ module Raven property sanitize_http_headers : Array(String | Regex) private def use_boundary?(field) - !(field.is_a?(Regex) || DEFAULT_FIELDS.includes?(field)) + !(field.is_a?(Regex) || field.in?(DEFAULT_FIELDS)) end private getter fields_pattern : Regex { diff --git a/src/raven/processors/sanitize_data.cr b/src/raven/processors/sanitize_data.cr index 45a7856..76229db 100644 --- a/src/raven/processors/sanitize_data.cr +++ b/src/raven/processors/sanitize_data.cr @@ -13,7 +13,7 @@ module Raven property? sanitize_credit_cards : Bool private def use_boundary?(field) - !(field.is_a?(Regex) || DEFAULT_FIELDS.includes?(field)) + !(field.is_a?(Regex) || field.in?(DEFAULT_FIELDS)) end private getter fields_pattern : Regex {