Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

473 B
Raw Blame
package proxmox

import "errors"

// APIErrorStatus returns the observed HTTP status, never a number quoted in a
// provider's error body. Unknown/local errors have no HTTP-status evidence.
func APIErrorStatus(err error) (int, bool) {
	var response *apiResponseError
	if errors.As(err, &response) && response != nil {
		return response.statusCode, true
	}
	var auth *authHTTPError
	if errors.As(err, &auth) && auth != nil {
		return auth.status, true
	}
	return 0, false
}