apiError

package
v0.0.15 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package apiError provides a structure to represent error responses from API calls. Copyright (c) APIMatic. All rights reserved.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ApiError

type ApiError struct {
	Request    http.Request      `json:"Request"`
	StatusCode int               `json:"StatusCode"`
	Headers    map[string]string `json:"Headers"`
	Body       string            `json:"Body"`
}

ApiError is the base struct for all error responses from the server. It holds information about the original HTTP request, the status code, headers, and response body.

func NewApiError

func NewApiError(
	statusCode int,
	body string) *ApiError

NewApiError is the constructor function for ApiError. It creates and returns a pointer to an ApiError instance with the given status code and response body.

func (*ApiError) Error

func (a *ApiError) Error() string

Error implements the Error method for the error interface. It returns a string representation of the ApiError instance when used in an error context.

Jump to

Keyboard shortcuts

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