Skip to content

Commit

Permalink
chore: update error formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
PatrickMenoti committed Jun 17, 2024
1 parent 024b492 commit 0fb1a7b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
12 changes: 6 additions & 6 deletions messages/manifest/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ var (
ErrorCacheNotFound = errors.New("Could not find this cache setting")
ErrorFunctionNotFound = errors.New("Could not find this edge function")
ErrorOriginNotFound = errors.New("Could not find this origin")
ErrorCreateOrigin = errors.New("Failed to create the origin: %s")
ErrorCreateCache = errors.New("Failed to create the cache setting: %s")
ErrorCreateRule = errors.New("Failed to create the rule in Rules Engine: %s")
ErrorUpdateOrigin = errors.New("Failed to update the origin: %s")
ErrorUpdateCache = errors.New("Failed to update the cache setting: %s")
ErrorUpdateRule = errors.New("Failed to update the rule in Rules Engine: %s")
ErrorCreateOrigin = errors.New("Failed to create the origin")
ErrorCreateCache = errors.New("Failed to create the cache setting")
ErrorCreateRule = errors.New("Failed to create the rule in Rules Engine")
ErrorUpdateOrigin = errors.New("Failed to update the origin")
ErrorUpdateCache = errors.New("Failed to update the cache setting")
ErrorUpdateRule = errors.New("Failed to update the rule in Rules Engine")
)
12 changes: 6 additions & 6 deletions pkg/manifest/manifest.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ func (man *ManifestInterpreter) CreateResources(conf *contracts.AzionApplication
}
updated, err := clientOrigin.Update(ctx, conf.Application.ID, OriginKeys[origin.Name], requestUpdate)
if err != nil {
return fmt.Errorf(msg.ErrorUpdateOrigin.Error(), err.Error())
return fmt.Errorf("%w: %s", msg.ErrorUpdateOrigin, err.Error())
}

newEntry := contracts.AzionJsonDataOrigin{
Expand All @@ -131,7 +131,7 @@ func (man *ManifestInterpreter) CreateResources(conf *contracts.AzionApplication
}
created, err := clientOrigin.Create(ctx, conf.Application.ID, requestCreate)
if err != nil {
return fmt.Errorf(msg.ErrorCreateOrigin.Error(), err.Error())
return fmt.Errorf("%w: %s", msg.ErrorCreateOrigin, err.Error())
}
newOrigin := contracts.AzionJsonDataOrigin{
OriginId: created.GetOriginId(),
Expand Down Expand Up @@ -164,7 +164,7 @@ func (man *ManifestInterpreter) CreateResources(conf *contracts.AzionApplication
}
updated, err := clientCache.Update(ctx, requestUpdate, conf.Application.ID, id)
if err != nil {
return fmt.Errorf(msg.ErrorUpdateCache.Error(), err.Error())
return fmt.Errorf("%w: %s", msg.ErrorUpdateCache, err.Error())
}
newCache := contracts.AzionJsonDataCacheSettings{
Id: updated.GetId(),
Expand All @@ -181,7 +181,7 @@ func (man *ManifestInterpreter) CreateResources(conf *contracts.AzionApplication
}
created, err := clientCache.Create(ctx, requestUpdate, conf.Application.ID)
if err != nil {
return fmt.Errorf(msg.ErrorCreateCache.Error(), err.Error())
return fmt.Errorf("%w: %s", msg.ErrorCreateCache, err.Error())
}
newCache := contracts.AzionJsonDataCacheSettings{
Id: created.GetId(),
Expand Down Expand Up @@ -219,7 +219,7 @@ func (man *ManifestInterpreter) CreateResources(conf *contracts.AzionApplication
requestUpdate.IdApplication = conf.Application.ID
updated, err := client.UpdateRulesEngine(ctx, requestUpdate)
if err != nil {
return fmt.Errorf(msg.ErrorUpdateRule.Error(), err.Error())
return fmt.Errorf("%w: %s", msg.ErrorUpdateRule, err.Error())
}
newRule := contracts.AzionJsonDataRules{
Id: updated.GetId(),
Expand All @@ -242,7 +242,7 @@ func (man *ManifestInterpreter) CreateResources(conf *contracts.AzionApplication
requestCreate.Order = &rule.Order
created, err := client.CreateRulesEngine(ctx, conf.Application.ID, rule.Phase, requestCreate)
if err != nil {
return fmt.Errorf(msg.ErrorCreateRule.Error(), err.Error())
return fmt.Errorf("%w: %s", msg.ErrorCreateRule, err.Error())
}
newRule := contracts.AzionJsonDataRules{
Id: created.GetId(),
Expand Down

0 comments on commit 0fb1a7b

Please sign in to comment.