errors

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package errors have the predefined errors that can be used to denote various types of errors

Index

Constants

View Source
const AWSSessionNotCreated = Error("some issue while creation of AWS session, session not initialized")

AWSSessionNotCreated error constant for issues in creating AWS Session

View Source
const InvalidFileStorage = Error("Invalid File Storage.Please set a valid value of FILE_STORE:{LOCAL or AZURE or GCP or AWS}")

InvalidFileStorage is used to show invalid file store config is provided

View Source
const SQLNotInitialized = Error("SQL not initialized")

SQLNotInitialized is used when SQL database is not initialized

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

type DB struct {
	Err error
}

DB standard error to encapsulate errors encountered when executing database operations

func (DB) Error

func (e DB) Error() string

Error returns the underlying database error message

type DataStoreNotInitialized

type DataStoreNotInitialized struct {
	DBName string
	Reason string
}

DataStoreNotInitialized standard error for errors in initializing datastore

func (DataStoreNotInitialized) Error

func (d DataStoreNotInitialized) Error() string

Error returns an error message regarding the initialization of data store

type DateTime

type DateTime struct {
	Value    string `json:"value"`
	TimeZone string `json:"timezone"`
}

DateTime is a structure to denote the date and time along with the timezone

type EntityAlreadyExists

type EntityAlreadyExists struct{}

EntityAlreadyExists is used when a given entity already exist in the system

func (EntityAlreadyExists) Error

func (e EntityAlreadyExists) Error() string

Error returns a message indicating that the entity already exists

type EntityNotFound

type EntityNotFound struct {
	Entity string `json:"entity"`
	ID     string `json:"id"`
}

EntityNotFound is used when a given entity is not found in the system

func (EntityNotFound) Error

func (e EntityNotFound) Error() string

Error returns an error message indicating that the entity was not found

type Error

type Error string

Error is a generic error of type string

func (Error) Error

func (e Error) Error() string

Error returns the error message of type string

type FileNotFound

type FileNotFound struct {
	FileName string `json:"fileName"`
	Path     string `json:"path"`
}

FileNotFound is used when a requested file is not found in the system

func (FileNotFound) Error

func (f FileNotFound) Error() string

Error returns an error message indicating that the file was not found

type ForbiddenRequest

type ForbiddenRequest struct {
	URL string
}

ForbiddenRequest is used when an incoming request is refused authorization

func (ForbiddenRequest) Error

func (f ForbiddenRequest) Error() string

Error returns an error message indicating that access to URL is forbidden

type HealthCheckFailed

type HealthCheckFailed struct {
	Dependency string `json:"dependency"`
	Reason     string `json:"reason"`
	Err        error  `json:"err"`
}

HealthCheckFailed is used when the health check for a dependency is failing

func (HealthCheckFailed) Error

func (h HealthCheckFailed) Error() string

Error returns a formatted message that includes information regarding failed health check

type InvalidParam

type InvalidParam struct {
	Param []string
}

InvalidParam is used when an invalid parameter is passed in the request

func (InvalidParam) Error

func (e InvalidParam) Error() string

Error returns an error message regarding incorrect parameter values for a request

type MethodMissing

type MethodMissing struct {
	Method string
	URL    string
}

MethodMissing is used when the requested method is not present for the called endpoint (used for method not allowed)

func (MethodMissing) Error

func (m MethodMissing) Error() string

Error returns an error message indicating that the method for a given URL is not defined

type MissingParam

type MissingParam struct {
	Param []string `json:"param"`
}

MissingParam is used when a required parameter is not present in the request

func (MissingParam) Error

func (e MissingParam) Error() string

Error returns an error message regarding required parameters for a request

type MissingTemplate

type MissingTemplate struct {
	FileLocation string
	FileName     string
}

func (MissingTemplate) Error

func (e MissingTemplate) Error() string

Error returns an error message regarding the absence of filename or existence of template

type MultipleErrors

type MultipleErrors struct {
	StatusCode int     `json:"-" xml:"-"`
	Errors     []error `json:"errors" xml:"errors"`
}

MultipleErrors is used when more than one error needs to be returned for a single request

func (MultipleErrors) Error

func (m MultipleErrors) Error() string

Error returns a formatted error message by concatenating multiple error messages

type Raw

type Raw struct {
	StatusCode int   `json:"status_code"`
	Err        error `json:"error"`
}

func (Raw) Error

func (r Raw) Error() string

Error returns the underlying error message or "Unknown Error" if no specific error is available

type Response

type Response struct {
	StatusCode int         `json:"-"`
	Code       string      `json:"code"`
	Reason     string      `json:"reason"`
	ResourceID string      `json:"resourceId,omitempty"`
	Detail     interface{} `json:"detail,omitempty"`
	Path       string      `json:"path,omitempty"`
	RootCauses []RootCause `json:"rootCauses,omitempty"`
	DateTime   `json:"datetime"`
}

Response is used when a detailed error response needs to be returned

func (*Response) Error

func (r *Response) Error() string

Error returns a formatted error message with the associated error reason

type RootCause

type RootCause map[string]interface{}

RootCause denotes the root cause for the error that occurred.

type Timeout

type Timeout struct {
	URL string
}

Timeout is used when request timeout occurs

func (Timeout) Error

func (t Timeout) Error() string

Error returns an error message indicating that the request to URL has timed out

Jump to

Keyboard shortcuts

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