Sha256: 7b6baf7c3f6806c8d8b6ae656a59b353dc4402f22e9e7df72edb6c047ca71a5b

Contents?: true

Size: 1.18 KB

Versions: 27

Compression:

Stored size: 1.18 KB

Contents

module Foobara
  module CommandConnectors
    module Transformers
      # This behavior is hard-coded but this is here to update the error classes in the manifest
      class AuthErrorsTransformer < Value::Transformer
        class << self
          # Feels awkward to have to do this for a few reasons. Passing self and also not
          # adhering to processor interface. Not sure how best to address this.
          def transform_error_context_type_map(transformed_command, map)
            if transformed_command.requires_authentication
              possible_error = PossibleError.new(CommandConnector::UnauthenticatedError)
              map = map.merge(possible_error.key.to_s => possible_error)
            end

            if transformed_command.allowed_rule
              possible_error = PossibleError.new(CommandConnector::NotAllowedError)
              map = map.merge(possible_error.key.to_s => possible_error)
            end

            map
          end
        end
        def applicable?(_request)
          false
        end

        def transform(_request)
          # :nocov:
          raise "Not expected to be called"
          # :nocov:
        end
      end
    end
  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
foobara-0.0.7 projects/command_connectors/src/transformers/auth_errors_transformer.rb
foobara-0.0.6 projects/command_connectors/src/transformers/auth_errors_transformer.rb
foobara-0.0.5 projects/command_connectors/src/transformers/auth_errors_transformer.rb
foobara-0.0.4 projects/command_connectors/src/transformers/auth_errors_transformer.rb
foobara-0.0.3 projects/command_connectors/src/transformers/auth_errors_transformer.rb
foobara-0.0.2 projects/command_connectors/src/transformers/auth_errors_transformer.rb
foobara-0.0.1 projects/command_connectors/src/transformers/auth_errors_transformer.rb