Sha256: 7e94659cfe74d094125e605403bdaaa1127f1adc8bce014545f8fd9727b428e1
Contents?: true
Size: 1.11 KB
Versions: 1
Compression:
Stored size: 1.11 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 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
lifen_fhir-0.6.0 | lib/lifen_fhir/error.rb |