Skip to content

Commit 14d8d8b

Browse files
authored
lxd: Log error on resultErrListAppend (#14514)
I noticed this `err` parameter was unused. So I had this idea of, instead of removing it, logging these erros, as the errors used with that function are currently not being disclosed to the user in any way. This way it is clear why one was not able to get info on that particular instance when looking in the logs. If this logging is not desirable, I will update the PR to just remove the unused parameter.
2 parents 3422deb + cff0be3 commit 14d8d8b

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

lxd/instances_get.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import (
2525
"github.com/canonical/lxd/shared/api"
2626
"github.com/canonical/lxd/shared/entity"
2727
"github.com/canonical/lxd/shared/filter"
28+
"github.com/canonical/lxd/shared/logger"
2829
"github.com/canonical/lxd/shared/version"
2930
)
3031

@@ -304,6 +305,8 @@ func instancesGet(d *Daemon, r *http.Request) response.Response {
304305
}
305306

306307
resultErrListAppend := func(inst db.Instance, err error) {
308+
logger.Error("Failed getting instance info", logger.Ctx{"err": err, "project": inst.Project, "instance": inst.Name})
309+
307310
instFull := &api.InstanceFull{
308311
Instance: api.Instance{
309312
Name: inst.Name,

0 commit comments

Comments
 (0)