{"modulePath":"github.com/cloudbase/garm","version":"v0.2.2","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package errors\n\nCopyright 2026 Cloudbase Solutions SRL\n\n\tLicensed under the Apache License, Version 2.0 (the \"License\"); you may\n\tnot use this file except in compliance with the License. You may obtain\n\ta copy of the License at\n\n\t     http://www.apache.org/licenses/LICENSE-2.0\n\n\tUnless required by applicable law or agreed to in writing, software\n\tdistributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n\tWARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n\tLicense for the specific language governing permissions and limitations\n\tunder the License.\n\n## Functions\n\n```go\nfunc InstanceIsBeingDeleted(s commonParams.InstanceStatus) bool\n```\nInstanceIsBeingDeleted reports whether an instance status is on the deletion lane, meaning the runner is already on its way out. Note that the lane is not strictly monotonic: a failed provider delete moves the instance from deleting to error. Tolerating a status observed here is still safe because reconciliation re-drives error back to pending\\_delete until the delete succeeds — the system converges by retry, and the intent behind a rejected transition to pending\\_delete (the runner should be removed) remains satisfied. Pair it with InstanceTransitionError.From.\n\n```go\nfunc InstanceIsProvisioning(s commonParams.InstanceStatus) bool\n```\nInstanceIsProvisioning reports whether an instance status indicates the provider is still creating the instance (or is about to). The provider worker owns this stage of the lifecycle: deletion cannot be requested until the create call returns (creating only transitions to error or running). Pair it with InstanceTransitionError.From to decide whether a rejected transition to pending\\_delete should be deferred to a later reconciliation pass instead of being treated as fatal.\n\n```go\nfunc NewRunnerTransitionError(from, to params.RunnerStatus) error\n```\nNewRunnerTransitionError returns a RunnerTransitionError describing an invalid runner status state machine transition.\n\n```go\nfunc RunnerIsTerminal(s params.RunnerStatus) bool\n```\nRunnerIsTerminal reports whether a runner status is terminal, meaning a transition to active can no longer succeed and a late \"started\" message for the runner is moot. Pair it with RunnerTransitionError.From.\n\n## Types\n\n```go\ntype RunnerTransitionError struct {\n\tFrom params.RunnerStatus\n\tTo   params.RunnerStatus\n}\n```\nRunnerTransitionError is returned when a requested runner status transition is rejected by the state machine. It carries the current (From) and requested (To) statuses as their proper type, so callers can compare them directly (via errors.As) without casting through strings. It also reports as a BadRequestError, so it maps to an HTTP 400.\n\n```go\nfunc (e *RunnerTransitionError) Error() string\n```\n\n```go\nfunc (e *RunnerTransitionError) Is(target error) bool\n```\n\n","path":"github.com/cloudbase/garm/internal/errors","name":"errors","synopsis":"","isRedistributable":true}
