Documentation ¶
Overview ¶
Package error is a collection of error-related functionality that aims to unify all of the errors across the SDK. Specifically, it abstracts away low level errors into higher-level, easier-to-digest errors of two types: SDK errors (represented by the `Error` class) and API errors (represented by the `APIError` class).
Index ¶
Constants ¶
const ( SpeechNilAudio = "SpeechNilAudio" WAVCorruptFile = "WAVCorruptFile" AudioFileOutputStreamNotOpened = "AudioFileOutputStreamNotOpened" AudioFileNotWritableStream = "AudioFileNotWritableStream" )
Define the various error codes possible
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIError ¶
type APIError struct { // Id is the request ID for which this error occurred. ID string `json:"id,omitempty"` // Status is the HTTP Status code for this error Status int `json:"status,omitempty"` // Code is the specific error code (for debugging purposes) Code string `json:"code,omitempty"` // Type is the type (BadRequest, NotFound, etc) of error Type string `json:"type,omitempty"` // Message is a descriptive message of the error, why it occurred, how to resolve, etc. Message string `json:"message,omitempty"` // Info is an optional field describing in detail the error for debugging purposes. Info string `json:"-"` }
APIError is the error that is returned from API calls.
type Error ¶
type Error struct { // Code is the specific error code (for debugging purposes) Code string `json:"code,omitempty"` // Message is a descriptive message of the error, why it occurred, how to resolve, etc. Message string `json:"message,omitempty"` // Info is an optional field describing in detail the error for debugging purposes. Info string `json:"-"` }
Error is a generic error that is returned when something SDK-related goes wrong.
func NewFromErrorCode ¶
NewFromErrorCode creates an `Error` object based on a predefined code and message.
func NewFromErrorCodeInfo ¶
NewFromErrorCodeInfo creates an `Error` object based on a predefined code and also includes some extra information about the error.