0
0
mirror of https://github.com/bpg/terraform-provider-proxmox.git synced 2025-06-29 18:21:10 +00:00
terraform-provider-proxmox/proxmox/api/errors.go
Pavel Boldyrev 0c9c2066fd
fix(vm,lxc,file): improve timeouts handling (#1222)
Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
2024-04-19 12:38:16 -04:00

35 lines
974 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 api
import (
"fmt"
)
// Error is a sentinel error type for API errors.
type Error string
func (err Error) Error() string {
return string(err)
}
// ErrNoDataObjectInResponse is returned when the server does not include a data object in the response.
const ErrNoDataObjectInResponse Error = "the server did not include a data object in the response"
// ErrResourceDoesNotExist is returned when the requested resource does not exist.
const ErrResourceDoesNotExist Error = "the requested resource does not exist"
// HTTPError is a generic error type for HTTP errors.
type HTTPError struct {
Code int
Message string
}
func (err HTTPError) Error() string {
return fmt.Sprintf("received an HTTP %d response - Reason: %s", err.Code, err.Message)
}