Skip to content

Commit

Permalink
fix: handle marshall errors
Browse files Browse the repository at this point in the history
  • Loading branch information
dareste committed Feb 28, 2023
1 parent f7be9a5 commit 123a91b
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/core/nginx.go
Original file line number Diff line number Diff line change
Expand Up @@ -318,10 +318,14 @@ func hasConfPath(files []*proto.File, confPath string) bool {

func (n *NginxBinaryType) WriteConfig(config *proto.NginxConfig) (*sdk.ConfigApply, error) {
if log.IsLevelEnabled(log.TraceLevel) {
jsonConfig, _ := json.Marshal(config)
log.Tracef("Writing config: %+v\n", string(jsonConfig))
jsonConfig, err := json.Marshal(config)
if err != nil {
log.Tracef("Writing raw config: %+v", config)
} else {
log.Tracef("Writing JSON config: %+v", string(jsonConfig))
}
}

details, ok := n.nginxDetailsMap[config.ConfigData.NginxId]
if !ok || details == nil {
return nil, fmt.Errorf("NGINX instance %s not found", config.ConfigData.NginxId)
Expand Down

0 comments on commit 123a91b

Please sign in to comment.