0
0
mirror of https://github.com/bpg/terraform-provider-proxmox.git synced 2025-07-01 11:02:59 +00:00
terraform-provider-proxmox/proxmox/utils.go

25 lines
529 B
Go

/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package proxmox
import (
"context"
"io"
"github.com/hashicorp/terraform-plugin-log/tflog"
)
func CloseOrLogError(ctx context.Context) func(io.Closer) {
return func(c io.Closer) {
if err := c.Close(); err != nil {
tflog.Error(ctx, "Failed to close", map[string]interface{}{
"error": err,
})
}
}
}