From a21ad899a70374797df1fd905f3966d8f77a6442 Mon Sep 17 00:00:00 2001 From: Thu Trang Pham Date: Tue, 7 Apr 2015 14:46:50 -0400 Subject: [PATCH] all Punit errors extend Punit::Error --- lib/pundit.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/pundit.rb b/lib/pundit.rb index 2bf0171..d2d0278 100644 --- a/lib/pundit.rb +++ b/lib/pundit.rb @@ -9,7 +9,8 @@ require "active_support/dependencies/autoload" module Pundit SUFFIX = "Policy" - class NotAuthorizedError < StandardError + class Error < StandardError; end + class NotAuthorizedError < Error attr_reader :query, :record, :policy def initialize(options = {}) @@ -22,9 +23,9 @@ module Pundit super(message) end end - class AuthorizationNotPerformedError < StandardError; end + class AuthorizationNotPerformedError < Error; end class PolicyScopingNotPerformedError < AuthorizationNotPerformedError; end - class NotDefinedError < StandardError; end + class NotDefinedError < Error; end extend ActiveSupport::Concern