Skip to content
This repository was archived by the owner on Feb 16, 2023. It is now read-only.

Commit 0e0bf2c

Browse files
authored
Merge pull request #238 from secrethub/feature/fix-template-error
Rephrase template processing error
2 parents 7469e82 + 41da8a8 commit 0e0bf2c

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

internals/secrethub/run.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ var (
3737
ErrReadEnvFile = errRun.Code("env_file_read_error").ErrorPref("could not read the environment file %s: %s")
3838
ErrEnvDirNotFound = errRun.Code("env_dir_not_found").Error(fmt.Sprintf("could not find specified environment. Make sure you have executed `%s set`.", ApplicationName))
3939
ErrTemplate = errRun.Code("invalid_template").ErrorPref("could not parse template at line %d: %s")
40-
ErrTemplateFile = errRun.Code("invalid_template_file").ErrorPref("template file '%s' is invalid: %s")
40+
ErrParsingTemplate = errRun.Code("template_parsing_failed").ErrorPref("error while processing template file '%s': %s")
4141
ErrInvalidTemplateVar = errRun.Code("invalid_template_var").ErrorPref("template variable '%s' is invalid: template variables may only contain uppercase letters, digits, and the '_' (underscore) and are not allowed to start with a number")
4242
ErrSecretsNotAllowedInKey = errRun.Code("secret_in_key").Error("secrets are not allowed in run template keys")
4343
)
@@ -418,7 +418,7 @@ func ReadEnvFile(filepath string, vars map[string]string, parser tpl.Parser) (En
418418
}
419419
env, err := NewEnv(r, vars, parser)
420420
if err != nil {
421-
return EnvFile{}, err
421+
return EnvFile{}, ErrParsingTemplate(filepath, err)
422422
}
423423
return EnvFile{
424424
path: filepath,
@@ -436,7 +436,7 @@ type EnvFile struct {
436436
func (e EnvFile) Env(secrets map[string]string, sr tpl.SecretReader) (map[string]string, error) {
437437
env, err := e.env.Env(secrets, sr)
438438
if err != nil {
439-
return nil, ErrTemplateFile(e.path, err)
439+
return nil, ErrParsingTemplate(e.path, err)
440440
}
441441
return env, nil
442442
}

0 commit comments

Comments
 (0)