Method: Spaceship::Client#raise_insufficient_permission_error!
- Defined in:
- spaceship/lib/spaceship/client.rb
#raise_insufficient_permission_error!(additional_error_string: nil, caller_location: 2) ⇒ Object
This also gets called from subclasses
831 832 833 834 835 836 837 838 839 840 841 842 843 844 |
# File 'spaceship/lib/spaceship/client.rb', line 831 def (additional_error_string: nil, caller_location: 2) # get the method name of the request that failed # `block in` is used very often for requests when surrounded for paging or retrying blocks # The ! is part of some methods when they modify or delete a resource, so we don't want to show it # Using `sub` instead of `delete` as we don't want to allow multiple matches calling_method_name = caller_locations(caller_location, 2).first.label.sub("block in", "").delete("!").strip # calling the computed property self.team_id can get us into an exception handling loop team_id = @current_team_id ? "(Team ID #{@current_team_id}) " : "" = "User #{self.user} #{team_id}doesn't have enough permission for the following action: #{calling_method_name}" += " (#{additional_error_string})" if additional_error_string.to_s.length > 0 raise InsufficientPermissions, end |