Exception: Supabase::Rails::ConfigError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/supabase/rails/errors.rb

Constant Summary collapse

CONFIG_GENERIC_ERROR =
"CONFIG_ERROR"
INVALID_MODE =
"INVALID_MODE"
"API_MODE_COOKIE_UNSUPPORTED"

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message, code = CONFIG_GENERIC_ERROR) ⇒ ConfigError

Returns a new instance of ConfigError.



61
62
63
64
# File 'lib/supabase/rails/errors.rb', line 61

def initialize(message, code = CONFIG_GENERIC_ERROR)
  super(message)
  @code = code
end

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code.



59
60
61
# File 'lib/supabase/rails/errors.rb', line 59

def code
  @code
end

Class Method Details



73
74
75
76
77
78
79
# File 'lib/supabase/rails/errors.rb', line 73

def self.api_mode_cookie_unsupported
  new(
    "`start_new_session_for` is not supported in :api mode. Cookies don't apply " \
    "to JWT-bearer flows — clients send the `Authorization: Bearer` header instead.",
    API_MODE_COOKIE_UNSUPPORTED
  )
end

.invalid_mode(value) ⇒ Object



66
67
68
69
70
71
# File 'lib/supabase/rails/errors.rb', line 66

def self.invalid_mode(value)
  new(
    %(Invalid `config.supabase.mode = #{value.inspect}`. Must be :api or :web.),
    INVALID_MODE
  )
end