MCPcopy Create free account
hub / github.com/couchbase/sync_gateway / buildErrorMessage

Method buildErrorMessage

rest/server_context.go:384–394  ·  view source on GitHub ↗

buildErrorMessage will build appropriate http error message based on the invalidConfig

(dbName string, invalidConfig *invalidConfigInfo)

Source from the content-addressed store, hash-verified

382
383// buildErrorMessage will build appropriate http error message based on the invalidConfig
384func (sc *ServerContext) buildErrorMessage(dbName string, invalidConfig *invalidConfigInfo) *base.HTTPError {
385 if invalidConfig.databaseError != nil {
386 err := base.HTTPErrorf(http.StatusNotFound, "Database %s has an invalid configuration: %v. You must update database config immediately through create db process", dbName, invalidConfig.databaseError.ErrMsg)
387 return err
388 }
389 if invalidConfig.collectionConflicts {
390 err := base.HTTPErrorf(http.StatusNotFound, "Database %s has conflicting collections. You must update database config immediately through create db process", dbName)
391 return err
392 }
393 return base.HTTPErrorf(http.StatusNotFound, "Mismatch in database config for database %s bucket name: %s and backend bucket: %s groupID: %s You must update database config immediately", base.MD(dbName), base.MD(invalidConfig.configBucketName), base.MD(invalidConfig.persistedBucketName), base.MD(sc.Config.Bootstrap.ConfigGroupID))
394}
395
396func (sc *ServerContext) GetDbConfig(name string) *DbConfig {
397 if dbConfig := sc.GetDatabaseConfig(name); dbConfig != nil {

Callers 1

GetInactiveDatabaseMethod · 0.95

Calls 2

HTTPErrorfFunction · 0.92
MDFunction · 0.92

Tested by

no test coverage detected