Skip to content

Commit 970a71a

Browse files
committed
fix(api): pipeline and application import error message
1 parent 495f133 commit 970a71a

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

engine/api/application/application_parser.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ func ParseAndImport(db gorp.SqlExecutor, cache cache.Store, proj *sdk.Project, e
6767
case sdk.SecretVariable:
6868
secret, err := decryptFunc(db, proj.ID, v.Value)
6969
if err != nil {
70-
return app, nil, sdk.WrapError(err, "ParseAndImport>> Unable to decrypt secret variable")
70+
return app, nil, sdk.WrapError(sdk.NewError(sdk.ErrWrongRequest, err), "ParseAndImport>> Unable to decrypt secret variable")
7171
}
7272
v.Value = secret
7373
}
@@ -104,7 +104,7 @@ func ParseAndImport(db gorp.SqlExecutor, cache cache.Store, proj *sdk.Project, e
104104

105105
kk, err := keys.Parse(db, proj.ID, kname, kval, decryptFunc)
106106
if err != nil {
107-
return app, nil, sdk.WrapError(err, "ParseAndImport>> Unable to parse key")
107+
return app, nil, sdk.WrapError(sdk.NewError(sdk.ErrWrongRequest, err), "ParseAndImport>> Unable to parse key")
108108
}
109109

110110
k := sdk.ApplicationKey{
@@ -132,7 +132,7 @@ func ParseAndImport(db gorp.SqlExecutor, cache cache.Store, proj *sdk.Project, e
132132
if eapp.VCSPassword != "" {
133133
clearPWD, err := decryptFunc(db, proj.ID, eapp.VCSPassword)
134134
if err != nil {
135-
return app, nil, sdk.WrapError(err, "ParseAndImport> Unable to decrypt vcs password")
135+
return app, nil, sdk.WrapError(sdk.NewError(sdk.ErrWrongRequest, err), "ParseAndImport> Unable to decrypt vcs password")
136136
}
137137
app.RepositoryStrategy.Password = clearPWD
138138
if errE := EncryptVCSStrategyPassword(app); errE != nil {
@@ -146,7 +146,7 @@ func ParseAndImport(db gorp.SqlExecutor, cache cache.Store, proj *sdk.Project, e
146146
if v.Type == sdk.SecretVariable {
147147
clearPWD, err := decryptFunc(db, proj.ID, v.Value)
148148
if err != nil {
149-
return app, nil, sdk.WrapError(err, "ParseAndImport> Unable to decrypt deployment strategy password")
149+
return app, nil, sdk.WrapError(sdk.NewError(sdk.ErrWrongRequest, err), "ParseAndImport> Unable to decrypt deployment strategy password")
150150
}
151151
v.Value = clearPWD
152152
}

engine/api/pipeline/pipeline_parser.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ func ParseAndImport(db gorp.SqlExecutor, cache cache.Store, proj *sdk.Project, e
1919
//Transform payload to a sdk.Pipeline
2020
pip, errP := epip.Pipeline()
2121
if errP != nil {
22-
return pip, nil, sdk.WrapError(errP, "importPipelineHandler> Unable to parse pipeline")
22+
return pip, nil, sdk.WrapError(sdk.NewError(sdk.ErrWrongRequest, errP), "importPipelineHandler> Unable to parse pipeline")
2323
}
2424

2525
// Check if pipeline exists

0 commit comments

Comments
 (0)