Skip to content

Commit

Permalink
[MM-1137]: log errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Kshitij-Katiyar committed Dec 5, 2024
1 parent bca94c3 commit 7fccd8e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions server/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ func (p *Plugin) OnConfigurationChange() error {

jsonBytes, err := json.Marshal(ec.AdminAPIToken)
if err != nil {
p.client.Log.Warn("Error marshaling the admin API token", "error", err)
p.client.Log.Warn("Error marshaling the admin API token", "error", err.Error())
return err
}

Expand All @@ -200,7 +200,7 @@ func (p *Plugin) OnConfigurationChange() error {

encryptedAdminAPIToken, err := encrypt(jsonBytes, []byte(encryptionKey))
if err != nil {
p.client.Log.Warn("Error encrypting the admin API token", "error", err)
p.client.Log.Warn("Error encrypting the admin API token", "error", err.Error())
return err
}
ec.AdminAPIToken = string(encryptedAdminAPIToken)
Expand Down Expand Up @@ -378,11 +378,11 @@ func (p *Plugin) SetupAutolink(instances *Instances) {
switch instance := instance.(type) {
case *cloudInstance:
if err = p.AddAutolinksForCloudInstance(instance); err != nil {
p.client.Log.Info("could not install autolinks for cloud instance", "instance", instance.BaseURL, "error", err)
p.client.Log.Info("could not install autolinks for cloud instance", "instance", instance.BaseURL, "error", err.Error())
}
case *cloudOAuthInstance:
if err = p.AddAutolinksForCloudOAuthInstance(instance); err != nil {
p.client.Log.Info("could not install autolinks for cloud-oauth instance", "instance", instance.JiraBaseURL, "error", err)
p.client.Log.Info("could not install autolinks for cloud-oauth instance", "instance", instance.JiraBaseURL, "error", err.Error())
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions server/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,13 +189,13 @@ func (p *Plugin) SetAdminAPITokenRequestHeader(req *http.Request) error {
encryptedAdminAPIToken := p.getConfig().AdminAPIToken
jsonBytes, err := decrypt([]byte(encryptedAdminAPIToken), []byte(p.getConfig().EncryptionKey))
if err != nil {
p.client.Log.Warn("Error decrypting admin API token", "error", err)
p.client.Log.Warn("Error decrypting admin API token", "error", err.Error())
return err
}
var adminAPIToken string
err = json.Unmarshal(jsonBytes, &adminAPIToken)
if err != nil {
p.client.Log.Warn("Error unmarshalling admin API token", "error", err)
p.client.Log.Warn("Error unmarshalling admin API token", "error", err.Error())
return err
}

Expand Down

0 comments on commit 7fccd8e

Please sign in to comment.