Exception: PgRls::Errors::TenantNotFound

Inherits:
StandardError
  • Object
show all
Defined in:
lib/pg_rls/errors/tenant_not_found.rb

Overview

Raise Tenant Not found and ensure that the tenant is resetted

Instance Method Summary collapse

Constructor Details

#initialize(msg = nil) ⇒ TenantNotFound

Returns a new instance of TenantNotFound.



7
8
9
10
11
# File 'lib/pg_rls/errors/tenant_not_found.rb', line 7

def initialize(msg = nil)
  reset_tenant_id
  @msg = msg
  super(msg)
end

Instance Method Details

#messageObject



13
14
15
# File 'lib/pg_rls/errors/tenant_not_found.rb', line 13

def message
  @msg || "Tenant Doesn't exist"
end

#reset_tenant_idObject



17
18
19
# File 'lib/pg_rls/errors/tenant_not_found.rb', line 17

def reset_tenant_id
  PgRls.connection_class.connection.execute('RESET rls.tenant_id')
end