Exception: DurableHuggingfaceHub::GatedRepoError

Inherits:
HfHubHTTPError show all
Defined in:
lib/durable_huggingface_hub/errors.rb

Overview

Error raised when attempting to access a gated repository without proper access.

Gated repositories require users to accept terms or have special permissions.

Examples:

raise GatedRepoError.new("meta-llama/Llama-2-7b")

Instance Attribute Summary collapse

Attributes inherited from HfHubHTTPError

#request_id, #response_body, #server_message, #status_code

Instance Method Summary collapse

Constructor Details

#initialize(repo_id, message: nil) ⇒ GatedRepoError

Creates a new gated repository error.

Parameters:

  • repo_id (String)

    Repository ID

  • message (String, nil) (defaults to: nil)

    Custom error message



204
205
206
207
208
# File 'lib/durable_huggingface_hub/errors.rb', line 204

def initialize(repo_id, message: nil)
  @repo_id = repo_id
  message ||= "Repository '#{repo_id}' is gated. You must be authenticated and have access."
  super(message, status_code: 403)
end

Instance Attribute Details

#repo_idString (readonly)

Returns The gated repository ID.

Returns:

  • (String)

    The gated repository ID



198
199
200
# File 'lib/durable_huggingface_hub/errors.rb', line 198

def repo_id
  @repo_id
end