Exception: Fluence::Gateway::ServiceNotAllowedError

Inherits:
Error
  • Object
show all
Defined in:
lib/fluence/gateway/errors.rb

Overview

Raised when a call tries to route through a backend service while the SDK is configured against an SSR tenant gateway (Configuration::Settings#ssr_tenant is true). SSR tenants expose a single backend directly, so the /backend/<service>/ prefix has no meaning and would produce a 404.

Surfaces both from explicit service: kwargs and from Client#with_service blocks.

Examples:

Handle misconfigured calls against an SSR tenant

begin
  Fluence::Gateway::Client.get('/api/v1/me', service: :base_valeur)
rescue Fluence::Gateway::ServiceNotAllowedError => e
  # drop the service: kwarg or point the SDK at a multi-tenant gateway
end

Constant Summary collapse

DEFAULT_MESSAGE =
'services are not available on an SSR tenant gateway'

Instance Method Summary collapse

Constructor Details

#initialize(msg = DEFAULT_MESSAGE) ⇒ ServiceNotAllowedError

Builds a new ServiceNotAllowedError. Defaults to DEFAULT_MESSAGE when no explicit message is provided, so the two raise sites (the service: kwarg path and the Client#with_service block helper) share one source of truth.

Parameters:

  • msg (String) (defaults to: DEFAULT_MESSAGE)

    the error message