tferrors

package
v0.0.76 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 16, 2026 License: MPL-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const NotFoundErrorSummary = "Resource Not Found"

NotFoundErrorSummary is the standard summary message for resource not found errors. This constant should be used when checking diagnostic summaries to detect not found errors.

Variables

This section is empty.

Functions

func HasNotFoundError

func HasNotFoundError(diags diag.Diagnostics) bool

HasNotFoundError checks if diagnostics contains a not found error.

func NewBadRequestError added in v0.0.61

func NewBadRequestError(operation Operation, detail string) diag.ErrorDiagnostic

NewBadRequestError creates a diagnostic error for 400 Conflict responses.

func NewConflictError added in v0.0.60

func NewConflictError(operation Operation, detail string) diag.ErrorDiagnostic

NewConflictError creates a diagnostic error for 409 Conflict responses.

func NewDiagnosticFromAPIError added in v0.0.61

func NewDiagnosticFromAPIError(operation Operation, err error, apiScopes []scopes.Scope, options ...ErrorOption) diag.Diagnostic

NewDiagnosticFromAPIError converts a gofalcon API error into a Terraform diagnostic.

func NewDiagnosticFromPayloadErrors added in v0.0.62

func NewDiagnosticFromPayloadErrors(operation Operation, payloadErrors []*models.MsaAPIError) diag.Diagnostic

NewDiagnosticFromPayloadErrors converts API payload errors to a Terraform diagnostic. This function checks for application-level errors within the API response payload using falcon.AssertNoError to convert MsaAPIError list to golang errors. Returns nil if there are no payload errors.

func NewEmptyResponseError added in v0.0.48

func NewEmptyResponseError(operation Operation) diag.ErrorDiagnostic

NewEmptyResponseError creates a diagnostic error for when an API returns no data.

func NewForbiddenError added in v0.0.48

func NewForbiddenError(operation Operation, requiredScopes []scopes.Scope) diag.ErrorDiagnostic

NewForbiddenError creates a diagnostic error for 403 Forbidden responses.

func NewNotFoundError

func NewNotFoundError(detail string) diag.ErrorDiagnostic

NewNotFoundError creates a diagnostic error for when a resource is not found.

func NewOperationError added in v0.0.48

func NewOperationError(operation Operation, err error) diag.ErrorDiagnostic

NewOperationError creates a diagnostic error for general operation failures.

func NewResourceNotFoundWarningDiagnostic added in v0.0.57

func NewResourceNotFoundWarningDiagnostic() diag.Diagnostic

func NewTooManyRequestsError added in v0.0.65

func NewTooManyRequestsError(operation Operation, detail string) diag.ErrorDiagnostic

NewTooManyRequestsError creates a diagnostic error for 429 Too Many Requests responses.

Types

type ErrorOption added in v0.0.61

type ErrorOption func(*errorConfig)

ErrorOption configures optional behavior for NewDiagnosticFromAPIError.

func WithBadRequestDetail added in v0.0.61

func WithBadRequestDetail(detail string) ErrorOption

WithBadRequestDetail provides a custom detail message for 400 Bad Request errors.

func WithConflictDetail added in v0.0.61

func WithConflictDetail(detail string) ErrorOption

WithConflictDetail provides a custom detail message for 409 Conflict errors.

func WithDetail added in v0.0.61

func WithDetail(detail string) ErrorOption

WithDetail provides a custom detail message for all other errors.

func WithForbiddenDetail added in v0.0.61

func WithForbiddenDetail(detail string) ErrorOption

WithForbiddenDetail provides a custom detail message for 403 Forbidden errors. If not provided, defaults to the API scope requirements.

func WithNotFoundDetail added in v0.0.61

func WithNotFoundDetail(detail string) ErrorOption

WithNotFoundDetail provides a custom detail message for 404 Not Found errors.

func WithServerErrorDetail added in v0.0.61

func WithServerErrorDetail(detail string) ErrorOption

WithServerErrorDetail provides a custom detail message for 5xx server errors.

func WithTooManyRequestsDetail added in v0.0.65

func WithTooManyRequestsDetail(detail string) ErrorOption

WithTooManyRequestsDetail provides a custom detail message for 429 Too Many Requests errors.

type Operation added in v0.0.48

type Operation string

Operation represents a CRUD operation type for consistent error reporting.

const (
	Create Operation = "create"
	Read   Operation = "read"
	Update Operation = "update"
	Delete Operation = "delete"
)

Operation constants define standard CRUD operations for consistent error reporting.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL