Sha256: eb8c304096469c499b840ab04eab5aa7a65304d275850e564893710ec369950e
Contents?: true
Size: 1.12 KB
Versions: 41
Compression:
Stored size: 1.12 KB
Contents
require 'singleton' module Immunio # General agent error class Error < RuntimeError; end # Error to block a request in progress # Ruby's `SecurityError` is outside the `StandardError` hierarchy, so it will # only be caught if somebody decides to catch it explicitly. # # `StandardError` and `RuntimeError` are both caught by a default rescue # block. This makes it too easy for a developer to catch and ignore one of # our blocking errors unintentionally. class BlockError < SecurityError; end # Request was not allowed by hook class RequestBlocked < BlockError class Result include Singleton # PG activerecord exception results must have an error_field method before Rails 4.x def error_field(_field) "" end end # PG activerecord exceptions must have a result method before Rails 4.x def result Result.instance end end # Response overridden by hook class OverrideResponse < BlockError attr_reader :status, :headers, :body def initialize(status, headers, body) @status = status @headers = headers @body = body end end end
Version data entries
41 entries across 41 versions & 1 rubygems