Merge branch 'fix_message' into bug_fix
This commit is contained in:
commit
0d60387610
@ -20,7 +20,8 @@ module Connectors
|
||||
collection.insert(record.to_mongo_hash)
|
||||
record
|
||||
rescue Mongo::OperationFailure => e
|
||||
if e.message =~ /^11000/
|
||||
# exception's message doesn't always start from error code
|
||||
if e.message =~ /11000/
|
||||
resource_name = StringHelper.underscore_class(record.class)
|
||||
raise InvalidRecord.new("Duplicate key error: #{resource_name} with id '#{record.id}'")
|
||||
end
|
||||
|
||||
@ -94,7 +94,7 @@ module Connectors
|
||||
|
||||
def check_project_auth(project_id, env, user_id)
|
||||
project = show(project_id)
|
||||
raise InvalidPrivileges.new("User '#{user_id}' unauthorized to work with project '#{project_id}'") unless project.check_authorization(user_id, env)
|
||||
raise InvalidPrivileges.new("User '#{user_id}' is unauthorized to work with project '#{project_id}' and environment '#{env}'") unless project.check_authorization(user_id, env)
|
||||
project
|
||||
end
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user