Sha256: b5821b01bc93409006e06f4a5029393d73bb99018283eb15e7b1404c9b64f381
Contents?: true
Size: 1.19 KB
Versions: 3
Compression:
Stored size: 1.19 KB
Contents
module LifenFhir class Error < StandardError attr_accessor :response, :params def initialize(message: , response: nil, params: {}, client: "app", token: nil) self.response = response self.params = params @client = client @token = token super(message) end def context return {} if response.nil? { url: response.env.url.to_s, method: response.env.method.to_s, token: trucanted_token, payload_sent: filtered_params, trace_id: extracted_trace_id, payload_received: response.body, client: @client } end def raven_context { :extra => { lifen: context } } end private def extracted_trace_id response.headers.fetch("X-B3-Traceid") { "unknown" } end def trucanted_token if m = /^(.{24})(.*)$/.match(@token) "#{m[1]}#{"*" * m[2].length}" else @token end end def filtered_params filtered_params = params filtered_params[:payload] = "filtered" if filtered_params.is_a?(Hash) and filtered_params.has_key? :payload filtered_params end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
lifen_fhir-0.7.1 | lib/lifen_fhir/error.rb |
lifen_fhir-0.7.0 | lib/lifen_fhir/error.rb |
lifen_fhir-0.6.1 | lib/lifen_fhir/error.rb |