errors

package
v0.1.10 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2026 License: MIT Imports: 2 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Error

type Error struct {
	Message          string            `json:"message,omitempty"`
	Type             string            `json:"type,omitempty"`
	Details          string            `json:"details,omitempty"`
	Code             int               `json:"code,omitempty"`
	Data             *ErrorData        `json:"error_data,omitempty"`
	Subcode          int               `json:"error_subcode,omitempty"`
	UserTitle        string            `json:"error_user_title,omitempty"`
	UserMsg          string            `json:"error_user_msg,omitempty"`
	FBTraceID        string            `json:"fbtrace_id,omitempty"`
	Href             string            `json:"href,omitempty"`
	OriginalResponse *OriginalResponse `json:"original_response,omitempty"`
}

Error represents a WhatsApp error returned by the API when a request fails. It implements the error interface.

Message represent a human-readable description of the error. Code: An error code. Common values are listed below, along with common recovery tactics. Data (optional): Additional information about the error. Subcode: Additional information about the error. Common values are listed below. UserMsg: The message to display to the user. The language of the message is based on the locale of the API request. UserTitle: The title of the dialog, if shown. The language of the message is based on the locale of the API request. FBTraceID: Internal support identifier. When reporting a bug related to a Graph API call, include the fbtrace_id to help us find log data for debugging. Example of error response

"error": {
        "message": "(#131030) Recipient phone number not in allowed list",
        "type": "OAuthException",
        "code": 131030,
        "error_data": {
             "messaging_product": "whatsapp",
            "details": "Recipient phone number not in allowed list: Add recipient phone number to recipient
                        list and try again."
        },
        "error_subcode": 2655007,
 	   "error_user_title": "Recipient phone number not in allowed list",
        "error_user_msg": "Add recipient phone number to recipient list and try again.",
        "fbtrace_id": "AI5Ob2z72R0JAUB5zOF-nao"
}

func (*Error) Error

func (e *Error) Error() string

func (*Error) String

func (e *Error) String() string

type ErrorData

type ErrorData struct {
	MessagingProduct string `json:"messaging_product,omitempty"`
	Details          string `json:"details,omitempty"`
}

ErrorData represents additional information about the error.

func (*ErrorData) String

func (e *ErrorData) String() string

type OriginalResponse added in v0.0.50

type OriginalResponse struct {
	Success bool `json:"success"`
}

type ValidationError

type ValidationError struct {
	Err         string `json:"error"`
	ErrorType   string `json:"error_type"`
	Message     string `json:"message"`
	LineStart   int    `json:"line_start"`
	LineEnd     int    `json:"line_end"`
	ColumnStart int    `json:"column_start"`
	ColumnEnd   int    `json:"column_end"`
}

func (ValidationError) Error

func (e ValidationError) Error() string

Jump to

Keyboard shortcuts

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