Sha256: 79d5f3b2f88f239df433ddd084c902089b79664501fceddd0324437406d167c1
Contents?: true
Size: 927 Bytes
Versions: 1
Compression:
Stored size: 927 Bytes
Contents
# frozen_string_literal: true require "securerandom" require "json" module MinatoErrorHandler class MinatoError < StandardError SERVER_ERROR = 500 attr_accessor :details, :caused_by, :request def code self.class.name end def message "An unknow error has occurred! See more details in caused_by field." end def status_code SERVER_ERROR end def unique_identfier @unique_identfier ||= SecureRandom.uuid end def serializable_attributes(methods) methods end def to_json(*_args) serialized_hash.to_json end def as_json serialized_hash.as_json end protected def serialized_hash methods = serializable_attributes(%i[caused_by code details message status_code unique_identfier]) data = {} methods.each do |method| data[method] = send(method) end data end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
minato_error_handler-0.1.2.pre.1 | lib/minato_error_handler/minato_error.rb |