apierrors

package
v2.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIError

type APIError struct {
	Message     string
	StatusCode  int
	Body        string
	RawResponse *http.Response
}

func NewAPIError

func NewAPIError(message string, statusCode int, body string, httpRes *http.Response) *APIError

func (*APIError) Error

func (e *APIError) Error() string

type BadRequestErrorResponse

type BadRequestErrorResponse struct {
	// Metadata object included in every API response. This provides context about the request and is essential for debugging, audit trails, and support inquiries. The `requestId` is particularly important when troubleshooting issues with the Unkey support team.
	Meta components.Meta `json:"meta"`
	// Extended error details specifically for bad request (400) errors. This builds on the BaseError structure by adding an array of individual validation errors, making it easy to identify and fix multiple issues at once.
	Error_ components.BadRequestErrorDetails `json:"error"`
}

BadRequestErrorResponse - Error response for invalid requests that cannot be processed due to client-side errors. This typically occurs when request parameters are missing, malformed, or fail validation rules. The response includes detailed information about the specific errors in the request, including the location of each error and suggestions for fixing it. When receiving this error, check the 'errors' array in the response for specific validation issues that need to be addressed before retrying.

func (*BadRequestErrorResponse) Error

func (e *BadRequestErrorResponse) Error() string

type ConflictErrorResponse

type ConflictErrorResponse struct {
	// Metadata object included in every API response. This provides context about the request and is essential for debugging, audit trails, and support inquiries. The `requestId` is particularly important when troubleshooting issues with the Unkey support team.
	Meta components.Meta `json:"meta"`
	// Base error structure following Problem Details for HTTP APIs (RFC 7807). This provides a standardized way to carry machine-readable details of errors in HTTP response content.
	Error_ components.BaseError `json:"error"`
}

ConflictErrorResponse - Error response when the request conflicts with the current state of the resource. This occurs when: - Attempting to create a resource that already exists - Modifying a resource that has been changed by another operation - Violating unique constraints or business rules

To resolve this error, check the current state of the resource and adjust your request accordingly.

func (*ConflictErrorResponse) Error

func (e *ConflictErrorResponse) Error() string

type ForbiddenErrorResponse

type ForbiddenErrorResponse struct {
	// Metadata object included in every API response. This provides context about the request and is essential for debugging, audit trails, and support inquiries. The `requestId` is particularly important when troubleshooting issues with the Unkey support team.
	Meta components.Meta `json:"meta"`
	// Base error structure following Problem Details for HTTP APIs (RFC 7807). This provides a standardized way to carry machine-readable details of errors in HTTP response content.
	Error_ components.BaseError `json:"error"`
}

ForbiddenErrorResponse - Error response when the provided credentials are valid but lack sufficient permissions for the requested operation. This occurs when: - The root key doesn't have the required permissions for this endpoint - The operation requires elevated privileges that the current key lacks - Access to the requested resource is restricted based on workspace settings

To resolve this error, ensure your root key has the necessary permissions or contact your workspace administrator.

func (*ForbiddenErrorResponse) Error

func (e *ForbiddenErrorResponse) Error() string

type GoneErrorResponse added in v2.1.0

type GoneErrorResponse struct {
	// Metadata object included in every API response. This provides context about the request and is essential for debugging, audit trails, and support inquiries. The `requestId` is particularly important when troubleshooting issues with the Unkey support team.
	Meta components.Meta `json:"meta"`
	// Base error structure following Problem Details for HTTP APIs (RFC 7807). This provides a standardized way to carry machine-readable details of errors in HTTP response content.
	Error_ components.BaseError `json:"error"`
}

GoneErrorResponse - Error response when the requested resource has been soft-deleted and is no longer available. This occurs when: - The resource has been marked as deleted but still exists in the database - The resource is intentionally unavailable but could potentially be restored - The resource cannot be restored through the API or dashboard

To resolve this error, contact support if you need the resource restored.

func (*GoneErrorResponse) Error added in v2.1.0

func (e *GoneErrorResponse) Error() string

type InternalServerErrorResponse

type InternalServerErrorResponse struct {
	// Metadata object included in every API response. This provides context about the request and is essential for debugging, audit trails, and support inquiries. The `requestId` is particularly important when troubleshooting issues with the Unkey support team.
	Meta components.Meta `json:"meta"`
	// Base error structure following Problem Details for HTTP APIs (RFC 7807). This provides a standardized way to carry machine-readable details of errors in HTTP response content.
	Error_ components.BaseError `json:"error"`
}

InternalServerErrorResponse - Error response when an unexpected error occurs on the server. This indicates a problem with Unkey's systems rather than your request.

When you encounter this error: - The request ID in the response can help Unkey support investigate the issue - The error is likely temporary and retrying may succeed - If the error persists, contact Unkey support with the request ID

func (*InternalServerErrorResponse) Error

type NotFoundErrorResponse

type NotFoundErrorResponse struct {
	// Metadata object included in every API response. This provides context about the request and is essential for debugging, audit trails, and support inquiries. The `requestId` is particularly important when troubleshooting issues with the Unkey support team.
	Meta components.Meta `json:"meta"`
	// Base error structure following Problem Details for HTTP APIs (RFC 7807). This provides a standardized way to carry machine-readable details of errors in HTTP response content.
	Error_ components.BaseError `json:"error"`
}

NotFoundErrorResponse - Error response when the requested resource cannot be found. This occurs when: - The specified resource ID doesn't exist in your workspace - The resource has been deleted or moved - The resource exists but is not accessible with current permissions

To resolve this error, verify the resource ID is correct and that you have access to it.

func (*NotFoundErrorResponse) Error

func (e *NotFoundErrorResponse) Error() string

type PreconditionFailedErrorResponse

type PreconditionFailedErrorResponse struct {
	// Metadata object included in every API response. This provides context about the request and is essential for debugging, audit trails, and support inquiries. The `requestId` is particularly important when troubleshooting issues with the Unkey support team.
	Meta components.Meta `json:"meta"`
	// Base error structure following Problem Details for HTTP APIs (RFC 7807). This provides a standardized way to carry machine-readable details of errors in HTTP response content.
	Error_ components.BaseError `json:"error"`
}

PreconditionFailedErrorResponse - Error response when one or more conditions specified in the request headers are not met. This typically occurs when: - Using conditional requests with If-Match or If-None-Match headers - The resource version doesn't match the expected value - Optimistic concurrency control detects a conflict

To resolve this error, fetch the latest version of the resource and retry with updated conditions.

func (*PreconditionFailedErrorResponse) Error

type UnauthorizedErrorResponse

type UnauthorizedErrorResponse struct {
	// Metadata object included in every API response. This provides context about the request and is essential for debugging, audit trails, and support inquiries. The `requestId` is particularly important when troubleshooting issues with the Unkey support team.
	Meta components.Meta `json:"meta"`
	// Base error structure following Problem Details for HTTP APIs (RFC 7807). This provides a standardized way to carry machine-readable details of errors in HTTP response content.
	Error_ components.BaseError `json:"error"`
}

UnauthorizedErrorResponse - Error response when authentication has failed or credentials are missing. This occurs when: - No authentication token is provided in the request - The provided token is invalid, expired, or malformed - The token format doesn't match expected patterns

To resolve this error, ensure you're including a valid root key in the Authorization header.

func (*UnauthorizedErrorResponse) Error

func (e *UnauthorizedErrorResponse) Error() string

Jump to

Keyboard shortcuts

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