msgtype

package
v0.6.5 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ReferenceStart  = "Reference(s) ("
	ReferenceEnd    = ")"
	ReferenceFormat = " Reference(s) { \"%v\" }"

	CannotConvertStringToByteForLessThanZero = "Cannot convert string to byte. String cannot be less than 0 for byte."
	CannotConvertStringToByteForMoreThan255  = "Cannot convert string to byte. String is a number " +
		"but larger than byte size. At max it could be 255."
	CannotConvertStringToByte = "Cannot convert string to byte."
)

Variables

This section is empty.

Functions

func Combine

func Combine(genericMsg, otherMsg, reference string) string

func CombineWithMsgType

func CombineWithMsgType(
	genericMsg Variation,
	otherMsg string,
	reference interface{},
) string

func EnumRangeNotMeet added in v0.4.1

func EnumRangeNotMeet(
	rangeStart interface{},
	rangeEnd interface{},
	wholeRange interface{},
) string

func Expecting added in v0.4.1

func Expecting(title, wasExpecting, actual interface{}) string

Expecting

returns

"%s - expecting (type:[%T]) : [\"%v\"], but received or actual (type:[%T]) : [\"%v\"]"

func ExpectingSimple added in v0.6.2

func ExpectingSimple(title, wasExpecting, actual interface{}) string

ExpectingSimple

returns

"%s - Expect (type:\"%T\")[\"%v\"] != [\"%v\"](type:\"%T\") Actual"

func ExpectingSimpleNoType added in v0.6.2

func ExpectingSimpleNoType(title, wasExpecting, actual interface{}) string

ExpectingSimpleNoType

returns

"%s - Expect [\"%v\"] != [\"%v\"] Actual"

func ManyErrorToSingle added in v0.6.2

func ManyErrorToSingle(errorItems []error) error

func ManyErrorToSingleDirect added in v0.6.2

func ManyErrorToSingleDirect(errorItems ...error) error

func MeaningFulError added in v0.4.1

func MeaningFulError(
	msgType Variation,
	funcName string,
	err error,
) error

func MeaningFulErrorHandle added in v0.4.1

func MeaningFulErrorHandle(
	msgType Variation,
	funcName string,
	err error,
)

func MeaningFulErrorWithData added in v0.4.6

func MeaningFulErrorWithData(
	msgType Variation,
	funcName string,
	err error,
	data interface{},
) error

func MergeErr added in v0.6.2

func MergeErr(errorItems ...error) error

func PanicOnIndexOutOfRange added in v0.2.0

func PanicOnIndexOutOfRange(length int, indexes *[]int)

func PanicRangeNotMeet added in v0.0.4

func PanicRangeNotMeet(
	otherMsg string,
	rangeStart interface{},
	rangeEnd interface{},
	wholeRange interface{},
) string

func RangeNotMeet added in v0.0.4

func RangeNotMeet(
	otherMsg string,
	rangeStart interface{},
	rangeEnd interface{},
	wholeRange interface{},
) string

func SimpleHandleErr added in v0.4.1

func SimpleHandleErr(err error, msg string)

func SimpleHandleErrMany added in v0.6.2

func SimpleHandleErrMany(msg string, errorItems ...error)

func SliceError added in v0.4.1

func SliceError(sep string, slice *[]string) error

func SliceErrorDefault added in v0.4.1

func SliceErrorDefault(slice *[]string) error

func SliceToError added in v0.4.1

func SliceToError(errorSlice []string) error

func SliceToErrorPtr added in v0.5.5

func SliceToErrorPtr(errorSlice *[]string) error

func ToValueString

func ToValueString(reference interface{}) string

Types

type ExpectingRecord added in v0.5.2

type ExpectingRecord struct {
	ExpectingTitle string
	WasExpecting   interface{}
}

func ExpectingFuture added in v0.5.2

func ExpectingFuture(title string, wasExpecting interface{}) *ExpectingRecord

ExpectingFuture

returns ExpectingRecord which will print

"%s - expecting (type:[%T]) : [\"%v\"], but received or actual (type:[%T]) : [\"%v\"]"

func (*ExpectingRecord) Error added in v0.5.2

func (it *ExpectingRecord) Error(actual interface{}) error

Error Expecting

returns

"%s - expecting (type:[%T]) : [\"%v\"], but received or actual (type:[%T]) : [\"%v\"]"

func (*ExpectingRecord) ErrorSimple added in v0.6.2

func (it *ExpectingRecord) ErrorSimple(actual interface{}) error

ErrorSimple Expecting

returns

"%s - Expect (type:\"%T\")[\"%v\"] != [\"%v\"](type:\"%T\") Actual"

func (*ExpectingRecord) ErrorSimpleNoType added in v0.6.2

func (it *ExpectingRecord) ErrorSimpleNoType(actual interface{}) error

ErrorSimpleNoType Expecting

returns

"%s - Expect [\"%v\"] != [\"%v\"] Actual"

func (*ExpectingRecord) Message added in v0.5.2

func (it *ExpectingRecord) Message(actual interface{}) string

Message Expecting

returns

"%s - expecting (type:[%T]) : [\"%v\"], but received or actual (type:[%T]) : [\"%v\"]"

func (*ExpectingRecord) MessageSimple added in v0.6.2

func (it *ExpectingRecord) MessageSimple(actual interface{}) string

MessageSimple Expecting

returns

"%s - Expect (type:\"%T\")[\"%v\"] != [\"%v\"](type:\"%T\") Actual"

func (*ExpectingRecord) MessageSimpleNoType added in v0.6.2

func (it *ExpectingRecord) MessageSimpleNoType(actual interface{}) string

MessageSimpleNoType

returns

"%s - Expect [\"%v\"] != [\"%v\"] Actual"

type Variation

type Variation string
const (
	InvalidRequest                         Variation = "Invalid : request, cannot process it."
	InvalidNullPointer                     Variation = "Invalid : null pointer, cannot process it."
	InvalidEmptyValue                      Variation = "Invalid : empty value given, cannot process it."
	OutOfRange                             Variation = "Out of range : given value, cannot process it."
	OutOfRangeLength                       Variation = "Out of range : given data length, cannot process it."
	InvalidEmptyPathErrorMessage           Variation = "Invalid : empty path given, cannot process it."
	InvalidStringErrorMessage              Variation = "Invalid : string cannot process it."
	InvalidIntegerErrorMessage             Variation = "Invalid : integer cannot process it."
	InvalidFloatErrorMessage               Variation = "Invalid : float cannot process it."
	InvalidTypeErrorMessage                Variation = "Invalid : type cannot process it."
	InvalidPointerErrorMessage             Variation = "Invalid : pointer cannot process it."
	InvalidValueErrorMessage               Variation = "Invalid : value cannot process it."
	InvalidCharErrorMessage                Variation = "Invalid : character cannot process it."
	InvalidArgumentsErrorMessage           Variation = "Invalid : arguments or argument cannot process it."
	InvalidAnyPathEmptyErrorMessage        Variation = "Invalid : any of the given path was empty, thus cannot process it."
	UnsupportedOperatingSystem             Variation = "Unsupported : given operating system is not supported by the executable or system!"
	UnsupportedArchitecture                Variation = "Unsupported : given operating system architecture is not supported by the executable or system!"
	UnsupportedCategory                    Variation = "Unsupported : given category or type or variant is not supported by the executable or system!"
	UnsupportedVersion                     Variation = "Unsupported : given version request is not supported by the executable or system!"
	UnsupportedInLinux                     Variation = "Unsupported : given request is not supported in Linux!"
	UnsupportedInUnix                      Variation = "Unsupported : given request is not supported in any of Unix (including Linux, macOs, CentOS etc) operating versions!"
	UnsupportedInWindows                   Variation = "Unsupported : given request is not supported in any of Windows operating system versions!"
	FailedToExecute                        Variation = "Failed : request failed to execute!"
	FailedToCreateCmd                      Variation = "Failed : To create cmd, command process call. Nil pointer! Cannot proceed further."
	FailedToParse                          Variation = "Failed : request failed to parse!"
	FailedToConvert                        Variation = "Failed : request failed to convert!"
	CannotRemoveIndexesFromEmptyCollection Variation = "Invalid operation: cannot remove indexes (either indexes are nil) or cannot remove indexes from the empty collection."
	CannotBeNegativeIndex                  Variation = "Invalid operation / index: index cannot be negative, operations canceled."
	CannotBeNegativeMessage                Variation = "Values or value cannot be negative value."
	CannotBeNilOrEmptyMessage              Variation = "Values or value cannot be nil or null or empty."
	CannotBeNilMessage                     Variation = "Values or value cannot be nil or null."
	CannotConvertToRwxWhereVarRwxPossible  Variation = "Cannot convert Rwx, it had wildcards in type. It can only be converted to VarRwx."
	ShouldBeNilMessage                     Variation = "Values or value should be nil or null."
	ShouldBeLessThanMessage                Variation = "Values or value should be less than the reference."
	ShouldBeGreaterThanMessage             Variation = "Values or value should be greater than the reference."
	ShouldBeLessThanEqualMessage           Variation = "Values or value should be less or equal to the reference."
	ShouldBeEqualToMessage                 Variation = "Values or value should be equal to the reference."
	LengthShouldBeEqualToMessage           Variation = "Values' or value's length should be equal to the reference."
	EmptyStatusMessage                     Variation = "Empty status found."
	NullResultMessage                      Variation = "Null or null or nil pointer, which is unexpected."
	EmptyArrayMessage                      Variation = "Empty array, which is unexpected."
	EmptyItemsMessage                      Variation = "Empty items, which is unexpected."
	PathErrorMessage                       Variation = "Path error, which is unexpected."
	PathChmodMismatchErrorMessage          Variation = "Path chmod doesn't match as expected. IsMatchesExpectation mismatch error."
	PathInvalidErrorMessage                Variation = "Path is not present in the location given."
	PathChmodApplyMessage                  Variation = "Path chmod apply error."
	PathChmodConvertFailedMessage          Variation = "Path chmod convert failed to octal."
	UnexpectedValueErrorMessage            Variation = "Unexpected value error, which is unexpected."
	UnexpectedTypeErrorMessage             Variation = "Unexpected type error, which is unexpected."
	IntegerOutOfRangeMessage               Variation = "Integer out of range. Range, which is unexpected."
	FloatOutOfRangeMessage                 Variation = "Float out of range. Range, which is unexpected."
	StringOutOfRangeMessage                Variation = "ToFileModeString out of range. Range, which is unexpected."
	ShouldBeGreaterThanEqualMessage        Variation = "Values or value should be greater or equal to the reference."
	UnixIgnoreMessage                      Variation = "Windows tests ignored in Unix."
	WindowsIgnoreMessage                   Variation = "Unix tests ignored in Windows."
	ComparatorShouldBeWithinRange          Variation = "Comparator should be within the range."
	EnumValuesOutOfRange                   Variation = "Out of Range / Invalid Range: Enum values are are not within the range as per the expectation."
	SearchInputEmpty                       Variation = "Search Input is either null or empty."
	SearchInputOrSearchTermEmpty           Variation = "Search Input or search term either null or empty."
	EmptyResultCannotMakeJson              Variation = "Empty result, cannot make json out of it."
	MarshallingFailed                      Variation = "Failed to marshal / parse / serialize."
	UnMarshallingFailed                    Variation = "Failed to unmarshal / parse / deserialize. Failed to convert to object from serialized data source."
	ParsingFailed                          Variation = "Failed to parse."
	TypeMismatch                           Variation = "TypeMismatch: Type is not as expected."
	NotImplemented                         Variation = "Not Implemented: Feature / method is not implemented yet."
	NotSupported                           Variation = "Not Supported: Feature / method is not supported yet."
	MissingOrPathsHavingIssues             Variation = "Missing or paths having other access issues!"
	JsonResultBytesAreNilOrEmpty           Variation = "Json Result: Bytes data either nil or empty, cannot process the data for the given resource."
	ValidataionFailed                      Variation = "Validation failed!"
)

func GetSet added in v0.0.9

func GetSet(
	isCondition bool,
	trueValue Variation,
	falseValue Variation,
) Variation

func GetSetVariant added in v0.0.9

func GetSetVariant(
	isCondition bool,
	trueValue string,
	falseValue string,
) Variation

func (Variation) Combine

func (variation Variation) Combine(otherMsg string, reference interface{}) string

func (Variation) CombineWithAnother added in v0.4.1

func (variation Variation) CombineWithAnother(
	another Variation,
	otherMsg string,
	reference interface{},
) Variation

func (Variation) Error

func (variation Variation) Error(otherMsg string, reference interface{}) error

func (Variation) ErrorNoRefs added in v0.3.6

func (variation Variation) ErrorNoRefs(otherMsg string) error

func (Variation) ErrorRefOnly added in v0.6.2

func (variation Variation) ErrorRefOnly(reference interface{}) error

func (Variation) HandleUsingPanic added in v0.0.4

func (variation Variation) HandleUsingPanic(otherMsg string, reference interface{})

func (Variation) String

func (variation Variation) String() string

Jump to

Keyboard shortcuts

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