MCPcopy Index your code
hub / github.com/coder/coder / userSecretConflictValidationErrors

Function userSecretConflictValidationErrors

coderd/usersecrets.go:403–423  ·  view source on GitHub ↗
(err error)

Source from the content-addressed store, hash-verified

401}
402
403func userSecretConflictValidationErrors(err error) []codersdk.ValidationError {
404 switch {
405 case database.IsUniqueViolation(err, database.UniqueUserSecretsUserNameIndex):
406 return []codersdk.ValidationError{{
407 Field: userSecretNameField,
408 Detail: "name already in use",
409 }}
410 case database.IsUniqueViolation(err, database.UniqueUserSecretsUserEnvNameIndex):
411 return []codersdk.ValidationError{{
412 Field: userSecretEnvNameField,
413 Detail: "environment variable already in use",
414 }}
415 case database.IsUniqueViolation(err, database.UniqueUserSecretsUserFilePathIndex):
416 return []codersdk.ValidationError{{
417 Field: userSecretFilePathField,
418 Detail: "file path already in use",
419 }}
420 default:
421 return nil
422 }
423}

Callers 2

postUserSecretMethod · 0.85
patchUserSecretMethod · 0.85

Calls 1

IsUniqueViolationFunction · 0.92

Tested by

no test coverage detected