debian-mirror-gitlab/lib/gitlab/ci/limit.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

38 lines
678 B
Ruby
Raw Normal View History

2021-02-22 17:27:13 +05:30
# frozen_string_literal: true
module Gitlab
module Ci
##
# Abstract base class for CI/CD Quotas
#
class Limit
LimitExceededError = Class.new(StandardError)
def initialize(_context, _resource)
end
def enabled?
raise NotImplementedError
end
def exceeded?
raise NotImplementedError
end
def message
raise NotImplementedError
end
def log_error!(extra_context = {})
2021-10-27 15:23:28 +05:30
::Gitlab::ErrorTracking.log_exception(limit_exceeded_error, extra_context)
end
protected
def limit_exceeded_error
LimitExceededError.new(message)
2021-02-22 17:27:13 +05:30
end
end
end
end