Skip to content

Commit

Permalink
raise CouchbaseOrm::Error
Browse files Browse the repository at this point in the history
  • Loading branch information
DamienVoreiter committed Sep 8, 2022
1 parent eed7f40 commit 922dbb8
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions lib/couchbase-orm/connection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module CouchbaseOrm
class Connection

def self.config
@@config || raise('Missing CouchbaseOrm connection config')
@@config || raise(CouchbaseOrm::Error, 'Missing CouchbaseOrm connection config')
end

def self.config=(config)
Expand All @@ -14,18 +14,18 @@ def self.config=(config)
def self.cluster
@cluster ||= begin
cb_config = Couchbase::Configuration.new
cb_config.connection_string = config[:connection_string] || raise('Missing CouchbaseOrm connection string')
cb_config.username = config[:username] || raise('Missing CouchbaseOrm username')
cb_config.password = config[:password] || raise('Missing CouchbaseOrm password')
cb_config.connection_string = config[:connection_string] || raise(CouchbaseOrm::Error, 'Missing CouchbaseOrm connection string')
cb_config.username = config[:username] || raise(CouchbaseOrm::Error, 'Missing CouchbaseOrm username')
cb_config.password = config[:password] || raise(CouchbaseOrm::Error, 'Missing CouchbaseOrm password')
Couchbase::Cluster.connect(cb_config)
end
end

def self.bucket
@bucket ||= begin
bucket_name = config[:bucket] || raise('Missing CouchbaseOrm bucket name')
cluster.bucket(bucket_name)
end
bucket_name = config[:bucket] || raise(CouchbaseOrm::Error, 'Missing CouchbaseOrm bucket name')
cluster.bucket(bucket_name)
end
end
end
end

0 comments on commit 922dbb8

Please sign in to comment.