Exception: Supabase::Storage::Errors::StorageApiError

Inherits:
StorageError
  • Object
show all
Defined in:
lib/supabase/storage/errors.rb

Overview

Raised when the Storage REST API returns a non-2xx response. Mirrors supabase-py’s StorageApiError contract — exposes :message, :code (the API’s ‘error` field, e.g. “InvalidKey”), and :status (HTTP status).

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message, code: nil, status: nil) ⇒ StorageApiError

Returns a new instance of StorageApiError.



15
16
17
18
19
# File 'lib/supabase/storage/errors.rb', line 15

def initialize(message, code: nil, status: nil)
  @code = code
  @status = status
  super(message.to_s)
end

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code.



13
14
15
# File 'lib/supabase/storage/errors.rb', line 13

def code
  @code
end

#statusObject (readonly)

Returns the value of attribute status.



13
14
15
# File 'lib/supabase/storage/errors.rb', line 13

def status
  @status
end

Instance Method Details

#to_hObject



21
22
23
# File 'lib/supabase/storage/errors.rb', line 21

def to_h
  { "name" => "StorageApiError", "message" => message, "code" => @code, "status" => @status }
end