errpref

package module
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2021 License: MIT Imports: 3 Imported by: 6

README

ErrPref - Adding Function Chains to Error Messages

Error Prefix - A lightweight GoLang type for attaching function chain lists and error context strings to error messages.

This software package was written in the Go programming language, a.k.a. Golang.

Table of Contents

The Problem

As my Go programs, types and methods have grown in sophistication and complexity, the need for improved error tracking, detailed error messages, and a record of code execution has become more important. The terms 'Function Chains' or 'Method Chains' as used here describes a list of the functions called prior to encountering a particular error. Adding function chain documentation to returned error messages seems to make error tracking and management a much easier proposition.

Basically, when I see an error message, especially during the development phase, the first question that comes to mind is, How the Hell did I get here? Answering that question quickly and with certainty usually requires a list of functions ordered by their execution sequence. Adding that information to error messages is the focus of this project.

The Solution

The ErrPref or error prefix project is intended to provide better function or method documentation in error messages returned by Go functions. Two types of objects have been defined for this purpose: ErrPref and ErrPrefixDto. Both of these types are designed to receive function chain information, format it and return the formatted strings for inclusion in error messages.

The idea is not to go overboard. I tried my hand at an error handler for Go Programs earlier and quickly realized that complexity was growing exponentially. At least at the outset of this project, the idea is to keep ErrPref simple, as a fast and efficient mechanism for adding error prefix text and function chain lists to error messages. That said, ErrPref is a work in progress. The current code is version 1.0.0. We shall see where this leads. For examples and documentation, refer to the source code file, errpref.go.

Definition of Terms

For our purposes error prefix consists of two elements, a function name, and an optional error context string.

Error Prefix

Error Prefix text is designed to be configured at the beginning of error messages and is most often used to document the thread of code execution by listing the calling sequence for a specific list of functions and/or methods.

Error Context

Error Context strings are designed to provide additional information about the function or method identified by the associated Error Prefix text. Typical context information might include variable names, variable values and additional details on function execution.

Error Context strings are optional and are always associated with an Error Prefix string.

String Formatting Conventions

When using the methods provided by types ErrPref and ErrPrefixDto it's best to use the following formatting conventions:

Error Prefix Delimiters

Error Prefix Element are delimited by one of two delimiters: new line character (\n) or in-line delimiter string ([SPACE]-[SPACE]).

Error Context Delimiters

Error Context Sub-Elements likewise have two delimiters: new line (\n[SPACE]:[SPACE][SPACE]) or in-line delimiter ([SPACE]:[SPACE])

ErrPref

Type, ErrPref is designed to format text strings for use in error messages. ErrPref is simple, lightweight, easy to use and seems to work in a variety of situations. The concept is straight forward, "put raw text strings in - get formatted error information out".

The ErrPref methods do not use pointer receivers. All receivers are value receivers.

Example Usage Summary

ErrPref passes error prefix information by string. An example calling sequence is shown as follows:


func(tx1 *Tx1) Something() {

 tx2 := Tx2{}

 err := Tx2.SomethingElse("Tx1.Something()")

 if err !=nil {
   fmt.Printf("%v\n",
   err.Error())
   return
 }

}

func(tx2 *Tx2) SomethingElse(errPrefix string) error {

  // errorPrefix now equals "Tx1.Something()"
  errorPrefix := ErrPref{}.EPrefOld(errPrefix)

  // errorPrefix now equals
  // "Tx1.Something() - Tx2.SomethingElse()"
  errorPrefix = ErrPref{}.EPref(
    errorPrefix,
    "Tx2.SomethingElse()")

  tx3 := Tx3{}

  err := Tx3.DoSomething(errorPrefix)

  if err !=nil {
   return err
  }
}

func(tx3 *Tx3) DoSomething(errorPrefix string) error {

    // Adding Error Context
    errorPrefix = ErrPref{}.EPrefCtx(
                   "Tx3.DoSomething()",
                   "A=B/C C== 0.0")

    .... bad code ....

    if isDivideByZero {
      return fmt.Errorf("%v\n" +
      "I divided by zero and got this error.\n",
      errorPrefix)
    }
}

When this error is returned up the function chain and finally printed out, the text will look like this:

 Tx1.Something() - Tx2.SomethingElse()
 Tx3.DoSomething() : A=B/C C== 0.0
 I divided by zero and got this error.

Conclusion

By now you're saying, "Whoopee - all you've done is concatenated a series of strings!"

That's what I thought, at first. However, there is the problem of delimiting error prefixes and error context information plus the problem of determining how much information to show on each line. For types ErrPref and ErrPrefixDto, the user may configure the line length which will determine whether a new line character (\n) or in-line delimiter string ([SPACE]-[SPACE]) is used to separate error prefix information.

ErrPrefixDto - Error Prefix Data Transfer Object

The type, ErrPrefixDto, offers the same services as type, ErrPref, but is packaged in a different architecture. While ErrPref methods receive a string and instantly return a formatted string, ErrPrefixDto encapsulates error prefix information in an internal array of Error Prefix Information objects. Strings are only created when the type's String() method is called. Instances of ErrPrefixDto are designed to be passed as input parameters to subsidiary methods.

With the sole exception of the String() method, All ErrPrefixDto methods have pointer receivers.

Public Facing Methods

A public method may receive error prefix information in a variety of formats. To date, the best use scenario follows this pattern:

func (numStrBasic *NumStrBasic) GetCountryFormatters(
	fmtCollection *FormatterCollection,
	countryCulture CountryCultureId,
	errorPrefix interface{}) error {
	
	var ePrefix *ErrPrefixDto
	var err error

	ePrefix,
		err = ErrPrefixDto{}.NewIEmpty(
		errorPrefix,
		"NumStrBasic.GetCountryFormatters()",
		"")

	if err != nil {
		return err
	}

	return numStrBasicQuark{}.ptr().
		getCountryFormatters(
			fmtCollection,
			countryCulture,
			ePrefix)
}

By calling ErrPrefixDto{}.NewIEmpty() with an empty interface, functions can pass error prefix information in any of 10-different formats:

  1. nil - A nil value is valid and generates an empty collection of error prefix and error context information.

  2. Stringer - The Stringer interface from the 'fmt' package. This interface has only one method:

              type Stringer interface {
                String() string
              }
  1. string - A string containing error prefix information.

  2. []string - A one-dimensional slice of strings containing error prefix information.

  3. [][2]string - A two-dimensional slice of strings containing error prefix and error context information.

  4. strings.Builder - An instance of strings.Builder. Error prefix information will be imported into the new returned instance of ErrPrefixDto.

  5. *strings.Builder - A pointer to an instance of strings.Builder. Error prefix information will be imported into the new returned instance of ErrPrefixDto.

  6. ErrPrefixDto - An instance of ErrPrefixDto. The ErrorPrefixInfo from this object will be copied to the new returned instance of *ErrPrefixDto.

  7. *ErrPrefixDto - A pointer to an instance of ErrPrefixDto. ErrorPrefixInfo from this object will be copied to the new returned instance of *ErrPrefixDto.

  8. IBasicErrorPrefix - An interface to a method generating a two-dimensional slice of strings containing error prefix and error context information.

             type IBasicErrorPrefix interface {
               GetEPrefStrings() [][2]string
             }
      

The Method Signature for ErrPrefixDto{}.NewIEmpty() is shown below:

func (ePrefDto ErrPrefixDto) NewIEmpty(
	iEPref interface{},
	newErrPrefix string,
	newErrContext string) (
	*ErrPrefixDto,
	error)

This pattern allows for use of the 'nil' value. iEPref takes a 'nil' value. If no error prefix information is present or required, just pass a 'nil' value for the iEPref parameter.

Finally, notice how the method name is added to the error prefix chain:

	ePrefix,
		err = ErrPrefixDto{}.NewIEmpty(
		errorPrefix,
		"NumStrBasic.GetCountryFormatters()",
		"")

The final empty string parameter is optional and could be used to add error context information.

Internal or Private Methods

In the Public Facing Methods example, above, method GetCountryFormatters() makes a call to internal, private method, getCountryFormatters(). Calls like this one to a supporting or subsidiary method usually pass a pointer to an instance of ErrPrefixDto. To date, the best use scenario for subsidiary methods follows this pattern:


func (nStrBasicQuark numStrBasicQuark) getCountryFormatters(
	fmtCollection *FormatterCollection,
	countryCulture CountryCultureId,
	ePrefix *ErrPrefixDto) (
	err error) {

	if ePrefix == nil {
		ePrefix = ErrPrefixDto{}.Ptr()
	} else {
		ePrefix = ePrefix.CopyPtr()
	}

	ePrefix.SetEPref(
		"numStrBasicQuark." +
			"getCountryFormatters()")

	if fmtCollection == nil {
		err = fmt.Errorf("%v\n"+
			"Error: Input parameter 'fmtCollection' is "+
			"a 'nil' pointer!\n",
			ePrefix.String())

		return err
	}

    ...

Notice how the function name is added to the error prefix chain:

ePrefix.SetEPref(
		"numStrBasicQuark." +
			"getCountryFormatters()")

Notice that this pattern allows for use of the 'nil' value for ePrefix. If no error prefix information is present or required, just pass a 'nil' parameter value.

This pattern provides a separate function chain string for each method. This architecture allows for multiple calls from parent methods without adding unnecessary and irrelevant text to the function chain. If an error occurs, only the relevant error prefix and error context information will be returned.

Error Context Example

In this example, a function chain is built by calls to multiple levels of the code hierarchy. The final call to method Tx3.DoSomething() triggers an error thereby returning the names of all methods in the call chains plus error context information.

func(tx1 *Tx1) Something() {

  ePrefDto := ErrPrefixDto{}.New()

  ePrefDto.SetEPref("Tx1.Something()")

  tx2 := Tx2{}

  err := Tx2.SomethingElse(&ePrefDto)

  if err !=nil {
    fmt.Printf("%v\n",
    err.Error())
    return
  }

}

func(tx2 *Tx2) SomethingElse(ePrefDto *ErrPrefixDto) error {
    
	if ePrefDto == nil {
		ePrefDto = ErrPrefixDto{}.Ptr()
	} else {
		ePrefDto = ePrefDto.CopyPtr()
	}

  	ePrefDto.SetEPref("Tx2.SomethingElse()")

  	tx3 := Tx3{}

  	err := Tx3.DoSomething(ePrefDto)

  	if err !=nil {
    	return err
  	}
}

func(tx3 *Tx3) DoSomething(ePrefDto *ErrPrefixDto) error {
    
	if ePrefDto == nil {
		ePrefDto = ErrPrefixDto{}.Ptr()
	} else {
		ePrefDto = ePrefDto.CopyPtr()
	}

    // Add error prefix and error context
    // information.
    ePrefDto.SetEPrefCtx(
       "Tx3.DoSomething()",
       "A=B/C C== 0.0")

    .... bad code ....

    if isDivideByZero {
      return fmt.Errorf("%v\n" +
      "I divided by zero and got this error.\n",
      ePrefDto.String())
    }
}


When this error is returned up the function chain and finally printed out, the text will look like this:

 Tx1.Something() - Tx2.SomethingElse()
 Tx3.DoSomething() : A=B/C C== 0.0
 I divided by zero and got this error.

Source Code Documentation

Source Documentation

Version

The latest version is Version 1.5.0.

This Version supports Go modules.

Version 1.5.0 Release Notes

License

Use of this source code is governed by the (open-source) MIT-style license which can be found in the LICENSE file located in this directory.

MIT License

Comments And Questions

Send questions or comments to:

    mike.go@paladinacs.net

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EPrefixLineLenCalc

type EPrefixLineLenCalc struct {
	// contains filtered or unexported fields
}

EPrefixLineLenCalc - Error Prefix Line Length Calculator This type is used to perform calculations on the line length of error prefix text output strings. Among the calculations performed, these associated methods determine how many error prefix and error context strings can be accommodated on the same line of text give a maximum line length limit.

func (*EPrefixLineLenCalc) CopyIn

func (ePrefixLineLenCalc *EPrefixLineLenCalc) CopyIn(
	incomingLineLenCalc *EPrefixLineLenCalc,
	ePrefix string) error

CopyIn - Receives an instance of type EPrefixLineLenCalc and proceeds to copy the internal member data variable values to the current EPrefixLineLenCalc instance.

----------------------------------------------------------------

Input Parameters

incomingLineLenCalc        *EPrefixLineLenCalc
   - A pointer to an instance of EPrefixLineLenCalc. This method
     will NOT change the values of internal member variables
     contained in this instance.

     All data values in this EPrefixLineLenCalc instance will
     be copied to current EPrefixLineLenCalc instance
     ('ePrefixLineLenCalc').

     If this EPrefixLineLenCalc instance proves to be invalid,
     an error will be returned.

ePrefix                    string
   - This is an error prefix which is included in all returned
     error messages. Usually, it contains the names of the calling
     method or methods. Note: Be sure to leave a space at the end
     of 'ePrefix'.

------------------------------------------------------------------------

Return Values

err                        error
   - If this method completes successfully, the returned error Type
     is set to 'nil'. If errors are encountered during processing,
     the returned error Type will encapsulate an error message.
     Note that this error message will incorporate the method
     chain and text passed by input parameter, 'ePrefix'.

func (*EPrefixLineLenCalc) CopyOut

func (ePrefixLineLenCalc *EPrefixLineLenCalc) CopyOut(
	ePrefix string) (
	EPrefixLineLenCalc,
	error)

CopyOut - Creates and returns a deep copy of the current EPrefixLineLenCalc. After completion of this operation, the returned copy and the current EPrefixLineLenCalc instance are identical in all respects.

------------------------------------------------------------------------

Input Parameters

ePrefix             string
   - This is an error prefix which is included in all returned
     error messages. Usually, it contains the names of the calling
     method or methods. Note: Be sure to leave a space at the end
     of 'ePrefix'.

------------------------------------------------------------------------

Return Values

EPrefixLineLenCalc
   - If this method completes successfully, a deep copy of the
     current EPrefixLineLenCalc instance will be returned through
     this parameter as a completely new instance of
     EPrefixLineLenCalc.

error
   - If this method completes successfully, the returned error Type
     is set to 'nil'. If errors are encountered during processing,
     the returned error Type will encapsulate an error message.
     Note that this error message will incorporate the method
     chain and text passed by input parameter, 'ePrefix'. The
     'ePrefix' text will be prefixed to the beginning of the returned
     error message.

func (*EPrefixLineLenCalc) CurrLineLenExceedsMaxLineLen

func (ePrefixLineLenCalc *EPrefixLineLenCalc) CurrLineLenExceedsMaxLineLen() bool

CurrLineLenExceedsMaxLineLen - If the length of the Current Line String (EPrefixLineLenCalc.currentLineStr) is greater than the Maximum Error String Length (EPrefixLineLenCalc.maxErrStringLength), this method returns 'true'.

currentLineStrLen > maxErrStringLength == true
currentLineStrLen <= maxErrStringLength == false

func (*EPrefixLineLenCalc) EPrefWithoutContextExceedsRemainLineLen

func (ePrefixLineLenCalc *EPrefixLineLenCalc) EPrefWithoutContextExceedsRemainLineLen() bool

EPrefWithoutContextExceedsRemainLineLen - Returns 'true' if the length of the in-line of in-line error prefix delimiter plus the length of the error prefix string exceeds the remaining unused line length.

in-line error prefix delimiter +
error prefix   > Remaining line Length
 This method returns 'true'.

func (*EPrefixLineLenCalc) EPrefixWithContextExceedsRemainLineLen

func (ePrefixLineLenCalc *EPrefixLineLenCalc) EPrefixWithContextExceedsRemainLineLen() bool

EPrefixWithContextExceedsRemainLineLen - Returns 'true' if the combination of in-line error prefix delimiter plus error prefix plus in-line error context delimiter plus error context string exceeds the remaining unused line length.

in-line error prefix delimiter +
error prefix +
in-line error context delimiter +
error context                     > Remaining line Length
 This method returns 'true'.

func (*EPrefixLineLenCalc) Empty

func (ePrefixLineLenCalc *EPrefixLineLenCalc) Empty()

Empty - Sets all internal variables to their zero or uninitialized values.

IMPORTANT This method will DELETE ALL VALID DATA contained in this instance of EPrefixLineLenCalc.

func (*EPrefixLineLenCalc) ErrPrefixHasContext

func (ePrefixLineLenCalc *EPrefixLineLenCalc) ErrPrefixHasContext() bool

ErrPrefixHasContext - Returns a boolean flag signaling whether the error prefix has an associated error context.

If this method returns 'true', it means that the encapsulated error prefix DOES HAVE an associated error context string.

func (*EPrefixLineLenCalc) ErrorContextIsEmpty

func (ePrefixLineLenCalc *EPrefixLineLenCalc) ErrorContextIsEmpty() bool

ErrorContextIsEmpty - Returns a boolean flag signalling whether the Error Context String is an empty string.

If this method returns 'true', it means that the Error Context String is empty and has a zero string length.

func (*EPrefixLineLenCalc) ErrorPrefixIsEmpty

func (ePrefixLineLenCalc *EPrefixLineLenCalc) ErrorPrefixIsEmpty() bool

ErrorPrefixIsEmpty - Returns a boolean flag signalling whether the Error Prefix String is an empty string.

If this method returns 'true', it means that the Error Prefix String is empty and has a zero string length.

func (*EPrefixLineLenCalc) GetCurrLineStr

func (ePrefixLineLenCalc *EPrefixLineLenCalc) GetCurrLineStr() string

GetCurrLineStr - Return the current line string. This string includes the characters which have been formatted and included in a single text line but which have not yet been written out text display. As soon as the current line string fills up with characters to the maximum allowed line length, the text line will be written out to the display device.

func (*EPrefixLineLenCalc) GetCurrLineStrLength

func (ePrefixLineLenCalc *EPrefixLineLenCalc) GetCurrLineStrLength() uint

GetCurrLineStrLength - Returns an unsigned integer value representing the number of characters in or string length of the Current Line String.

The Current Line String contains the characters which have been collected thus far from error prefix and error context information. The current line string is used to control maximum line length and stores the characters which have not yet been written out to the text display.

As soon as the Current Line String fills up with characters to the maximum allowed line length, the text line will be written out to the display device.

func (*EPrefixLineLenCalc) GetDelimiterInLineErrContext

func (ePrefixLineLenCalc *EPrefixLineLenCalc) GetDelimiterInLineErrContext() string

GetDelimiterInLineErrContext - Returns the In-Line Error Context delimiter as a string.

func (*EPrefixLineLenCalc) GetDelimiterInLineErrPrefix

func (ePrefixLineLenCalc *EPrefixLineLenCalc) GetDelimiterInLineErrPrefix() string

GetDelimiterInLineErrPrefix - Returns the In-Line Error Prefix delimiter as a string.

func (*EPrefixLineLenCalc) GetDelimiterNewLineErrContext

func (ePrefixLineLenCalc *EPrefixLineLenCalc) GetDelimiterNewLineErrContext() string

GetDelimiterNewLineErrContext - Returns the New Line Error Context delimiter as a string.

func (*EPrefixLineLenCalc) GetDelimiterNewLineErrPrefix

func (ePrefixLineLenCalc *EPrefixLineLenCalc) GetDelimiterNewLineErrPrefix() string

GetDelimiterNewLineErrPrefix - Returns the New Line Error Prefix delimiter as a string.

func (*EPrefixLineLenCalc) GetErrorContextStr

func (ePrefixLineLenCalc *EPrefixLineLenCalc) GetErrorContextStr() string

GetErrorContextStr - Returns the error context string.

func (*EPrefixLineLenCalc) GetErrorPrefixStr

func (ePrefixLineLenCalc *EPrefixLineLenCalc) GetErrorPrefixStr() string

GetErrorPrefixStr - Returns the error prefix string.

func (*EPrefixLineLenCalc) GetMaxErrStringLength

func (ePrefixLineLenCalc *EPrefixLineLenCalc) GetMaxErrStringLength() uint

GetMaxErrStringLength - Returns the current the value for maximum error string length. This limit controls the line length for text displays of error prefix strings.

The value of maximum error string length is returned as an unsigned integer.

func (*EPrefixLineLenCalc) GetRemainingLineLength

func (ePrefixLineLenCalc *EPrefixLineLenCalc) GetRemainingLineLength() uint

GetRemainingLineLength - Returns the remaining line length. This is the difference between current line length and Maximum Error String Length.

remainingLineLen = maxErrStringLen - currentLineStringLen

If currentLineStringLen is greater than Maximum Error String Length, the Remaining String Length is zero.

func (*EPrefixLineLenCalc) IsErrPrefixLastIndex

func (ePrefixLineLenCalc *EPrefixLineLenCalc) IsErrPrefixLastIndex() bool

IsErrPrefixLastIndex - Returns a boolean flag signalling whether the encapsulated ErrorPrefixInfo object is the last element in an array.

If this method returns 'true', it means that the encapsulated ErrorPrefixInfo object is the last element in an array of ErrorPrefixInfo objects.

func (*EPrefixLineLenCalc) IsValidInstance

func (ePrefixLineLenCalc *EPrefixLineLenCalc) IsValidInstance() bool

IsValidInstance - Returns a boolean flag signalling whether the current EPrefixLineLenCalc instance is valid, or not.

If this method returns a boolean value of 'false', it signals that the current EPrefixLineLenCalc instance is invalid.

If this method returns a boolean value of 'true', it signals that the current EPrefixLineLenCalc instance is valid in all respects.

----------------------------------------------------------------

Input Parameters

--- NONE ---

-----------------------------------------------------------------

Return Values

bool
   - This boolean flag signals whether the current
     EPrefixLineLenCalc instance is valid.

     If this method returns a value of 'false', it signals that
     the current EPrefixLineLenCalc instance is invalid.

     If this method returns a value of 'true', it signals that
     the current EPrefixLineLenCalc instance is valid in all
     respects.

func (*EPrefixLineLenCalc) IsValidInstanceError

func (ePrefixLineLenCalc *EPrefixLineLenCalc) IsValidInstanceError(
	ePrefix string) error

IsValidInstanceError - Returns an error type signalling whether the current EPrefixLineLenCalc instance is valid, or not.

If this method returns an error value NOT equal to 'nil', it signals that the current EPrefixLineLenCalc instance is invalid.

If this method returns an error value which IS equal to 'nil', it signals that the current EPrefixLineLenCalc instance is valid in all respects.

----------------------------------------------------------------

Input Parameters

ePrefix             string
   - This is an error prefix which is included in all returned
     error messages. Usually, it contains the names of the calling
     method or methods. Note: Be sure to leave a space at the end
     of 'ePrefix'.

-----------------------------------------------------------------

Return Values

error
   - If this returned error type is set equal to 'nil', it
     signals that the current EPrefixLineLenCalc is valid in
     all respects.

     If this returned error type is NOT equal to 'nil', it
     signals that the current EPrefixLineLenCalc is invalid.

func (EPrefixLineLenCalc) New

func (ePrefixLineLenCalc EPrefixLineLenCalc) New() EPrefixLineLenCalc

New - Returns a new, empty instance of type EPrefixLineLenCalc.

func (EPrefixLineLenCalc) Ptr

func (ePrefixLineLenCalc EPrefixLineLenCalc) Ptr() *EPrefixLineLenCalc

Ptr - Returns a pointer to a new, empty instance of type EPrefixLineLenCalc.

func (*EPrefixLineLenCalc) SetCurrentLineStr

func (ePrefixLineLenCalc *EPrefixLineLenCalc) SetCurrentLineStr(
	currentLineStr string)

SetCurrentLineStr - Sets the Current Line String. This string represents the characters which have been collected thus far from error prefix and error context information. The current line string is used to control maximum line length and stores the characters which have not yet been written out to the text display.

Be sure to set the Maximum Error String Length. Both the Current Line String and the Maximum Error String Length are essential to line length calculations.

func (*EPrefixLineLenCalc) SetEPrefDelimiters

func (ePrefixLineLenCalc *EPrefixLineLenCalc) SetEPrefDelimiters(
	ePrefDelimiters ErrPrefixDelimiters,
	ePrefix string) error

SetEPrefDelimiters - Sets the Error Prefix Delimiters member variable.

The Error Prefix Delimiters object stores string delimiters used to terminate error prefix and error context strings.

----------------------------------------------------------------

Input Parameters

ePrefDelimiters     ErrPrefixDelimiters
   - An Error Prefix Delimiters object. This delimiters object
     contains information on the delimiter strings used to
     terminate error prefix and error context strings.

     type ErrPrefixDelimiters struct {
       inLinePrefixDelimiter      string
       lenInLinePrefixDelimiter   uint
       newLinePrefixDelimiter     string
       lenNewLinePrefixDelimiter  uint
       inLineContextDelimiter     string
       lenInLineContextDelimiter  uint
       newLineContextDelimiter    string
       lenNewLineContextDelimiter uint
       maxErrStringLength         uint
     }

ePrefix             string
   - This is an error prefix which is included in all returned
     error messages. Usually, it contains the names of the calling
     method or methods. Note: Be sure to leave a space at the end
     of 'ePrefix'.

-----------------------------------------------------------------

Return Values

error
   - If this method completes successfully, the returned error
     Type is set equal to 'nil'. If errors are encountered
     during processing, the returned error Type will
     encapsulate an error message. Note that this error message
     will incorporate the method chain and text passed by input
     parameter, 'ePrefix'. The 'ePrefix' text will be prefixed
     to the beginning of the error message.

func (*EPrefixLineLenCalc) SetErrPrefixInfo

func (ePrefixLineLenCalc *EPrefixLineLenCalc) SetErrPrefixInfo(
	errPrefixInfo *ErrorPrefixInfo,
	ePrefix string) error

SetErrPrefixInfo - Sets the Error Prefix Information Object member variable.

The Error Prefix Information Object stores information on the error prefix and error context strings.

----------------------------------------------------------------

Input Parameters

errPrefixInfo       *ErrorPrefixInfo
   - This Error Prefix Information Object stores information on
     the error prefix and error context strings.

     type ErrorPrefixInfo struct {
       isValid                bool
       isLastIdx              bool // Signals the last index in the array
       errorPrefixStr         string
       lenErrorPrefixStr      uint
       errPrefixHasContextStr bool
       errorContextStr        string
       lenErrorContextStr     uint
     }

ePrefix             string
   - This is an error prefix which is included in all returned
     error messages. Usually, it contains the names of the calling
     method or methods. Note: Be sure to leave a space at the end
     of 'ePrefix'.

-----------------------------------------------------------------

Return Values

error
   - If this method completes successfully, the returned error
     Type is set equal to 'nil'. If errors are encountered
     during processing, the returned error Type will
     encapsulate an error message. Note that this error message
     will incorporate the method chain and text passed by input
     parameter, 'ePrefix'. The 'ePrefix' text will be prefixed
     to the beginning of the error message.

func (*EPrefixLineLenCalc) SetMaxErrStringLength

func (ePrefixLineLenCalc *EPrefixLineLenCalc) SetMaxErrStringLength(
	maxErrStringLength uint)

SetMaxErrStringLength - Sets EPrefixLineLenCalc.maxErrStringLength

This method sets the value for maximum error string length. This limit controls the line length for text displays of error prefix strings.

Set this value first, before setting Current Line Length

type ErrPref

type ErrPref struct {
	// contains filtered or unexported fields
}

ErrPref - This type is provides methods useful in formatting error prefix and error context strings.

The error prefix text is designed to be configured at the beginning of error messages and is most often used to document the thread of code execution by listing the calling sequence for specific functions and methods.

The error context string is designed to provide additional error context information associated with the currently executing function or method. Typical context information might include variable names, variable values and additional details on function execution.

Note that there are no 'pointer' methods provided for this type. This is because the type is not designed to store information. Its only function is to receive process and return strings of error prefix information.

------------------------------------------------------------------------

- IMPORTANT - None of the error prefix strings returned by the methods on this type are terminated with a new line character ('\n'). That means that none of the strings end with a new line character.

If you prefer that error prefix strings be terminated with a new line character, you have two options:

  1. Add the terminating new line character in your code.

    OR

  2. Use the Error Prefix Data Transfer Object type 'ErrPrefixDto'.

------------------------------------------------------------------------

Recommended Usage Examples

ePrefix = ErrPref{}.EPrefCtx(
  ePrefix,
  "Tx7.TrySomethingNew()",
   "")

ePrefix = ErrPref{}.EPref(
   ePrefix,
   "Tx14.SomeFabulousAndComplexStuff()")

    actualStr := ErrPref{}.SetCtxt(
     initialStr,
      "A!=B")

Example Error Prefix String with Context information.

     "Tx1.AVeryVeryLongMethodNameCalledSomething()\\n" +
     " :  A->B\\n" +
     "Tx2.SomethingElse() : A==B\\n" +
     "Tx3.DoSomething() : A==10\\n" +
     "Tx4() : A/10==4 - Tx5() : A!=B"

func (ErrPref) ConvertNonPrintableChars

func (ePref ErrPref) ConvertNonPrintableChars(
	nonPrintableChars []rune,
	convertSpace bool) (
	printableChars string)

ConvertNonPrintableChars - Receives a string containing non-printable characters and converts them to 'printable' characters returned in a string.

This method is primarily used for testing an evaluation.

Examples of non-printable characters are '\n', '\t' or 0x06 (Acknowledge). These example characters would be translated into printable string characters as: "\\n", "\\t" and "[ACK]".

Space characters are typically translated as " ". However, if the input parameter 'convertSpace' is set to 'true' then all spaces are converted to "[SPACE]" in the returned string.

Reference:

https://www.juniper.net/documentation/en_US/idp5.1/topics/reference/general/intrusion-detection-prevention-custom-attack-object-extended-ascii.html

This method is useful for verifying error prefix strings which are routinely populated with non-printable characters.

------------------------------------------------------------------------

Input Parameters

nonPrintableChars   []rune
   - An array of runes containing non-printable characters.
     The non-printable characters will be converted to
     printable characters.

convertSpace        bool
   - Space or white space characters (0x20) are by default
     translated as " ". However, if this parameter is set to
     'true', space characters will be converted to "[SPACE]".

------------------------------------------------------------------------

Return Values

printableChars      string
   - This returned string is identical to input parameter
     'nonPrintableChars' with the exception that non-printable
     characters are translated into printable characters.

------------------------------------------------------------------------

Example Usage

testStr := "Hello world!\n"
testRunes := []rune(testStr)
ePrefix := "theCallingFunction()"

ePrefQuark := errPrefQuark{}

actualStr :=
  ePrefQuark.
    convertNonPrintableChars(
         testRunes,
         true,
         ePrefix)

----------------------------------------------------
'actualStr' is now equal to:
   "Hello[SPACE]world!\\n"

func (ErrPref) EPref

func (ePref ErrPref) EPref(
	oldErrPref string,
	newErrPref string) string

EPref - Returns a string concatenating the old error prefix the new custom, user-defined error prefix. The new error prefix is typically used to document method or function chains in error messages.

The old error prefix contains the function chain or series which led to the function next in line for execution.

The error prefix text is designed to be configured at the beginning of error messages and is most often used to document the thread of code execution by listing the calling sequence for specific functions and methods.

- IMPORTANT -

The last line of error prefix strings returned by the methods on this type are NOT terminated with a new line character ('\n'). That means that the last line of error prefix strings will never end with a new line character ('\n').

If you prefer that the last line of error prefix strings be terminated with a new line character ('\n'), you have two options:

  1. Add the terminating new line character in your code.

    OR

  2. Use the Error Prefix Data Transfer Object type 'ErrPrefixDto'.

----------------------------------------------------------------

Input Parameters

oldErrPref          string
   - This includes the previous or preexisting error prefix
     string. This string will be parsed into error prefix
     and error context components before being converted into
     a single, formatted string containing error prefix and
     error context information.

     This string should consist of a series of error prefix
     strings. Error prefixes should be delimited by either a
     new line character ('\n') or the in-line delimiter string,
     " - ".

     If this string contains associated error context strings
     as well, they should be delimited with either a new line
     delimiter string, "\n :  " or an in-line delimiter string,
     " : ".

newErrPref          string
   - The new error prefix represents typically identifies
     the function or method which is currently executing. This
     information is used to document source code execution flow
     in error messages.

     If 'newErrPref' equates to an empty string, this method will
     return the formatted version of 'oldErrPref' and no new error
     prefix information will be added.

-----------------------------------------------------------------

Return Values

string
   - This method will return the consolidated error prefix text.

     The error prefix text is designed to be configured at the
     beginning of error messages and is most often used to
     document the thread of code execution by listing the calling
     sequence for specific functions and methods.

func (ErrPref) EPrefCtx

func (ePref ErrPref) EPrefCtx(
	oldErrPref string,
	newErrPref string,
	newContext string) string

EPrefCtx - Receives an old error prefix, new error prefix and a new context string which are concatenated and returned as a combined string.

Error prefix text is designed to be configured at the beginning of error messages and is most often used to document the thread of code execution by listing the calling sequence for a specific list of functions and methods.

The error context string is designed to provide additional information about the function or method identified by the associated error prefix string. Typical context information might include variable names, variable values and additional details on function execution.

- IMPORTANT -

The last line of error prefix strings returned by the methods on this type are NOT terminated with a new line character ('\n'). That means that the last line of error prefix strings will never end with a new line character ('\n').

If you prefer that the last line of error prefix strings be terminated with a new line character ('\n'), you have two options:

  1. Add the terminating new line character in your code.

    OR

  2. Use the Error Prefix Data Transfer Object type 'ErrPrefixDto'.

----------------------------------------------------------------

Input Parameters

oldErrPref          string
   - This includes the previous or preexisting error prefix
     string. This string will be parsed into error prefix
     and error context components before being converted into
     a single, formatted string containing error prefix and
     error context information.

     This string should consist of a series of error prefix
     strings. Error prefixes should be delimited by either a
     new line character ('\n') or the in-line delimiter string,
     " - ".

     If this string contains associated error context strings
     as well, they should be delimited with either a new line
     delimiter string, "\n :  " or an in-line delimiter string,
     " : ".

newErrPref          string
   - The new error prefix represents the error prefix string
     associated with the function or method which is currently
     executing. This parameter is optional and will accept an
     empty string, but there isn't much point in calling this
     method without a substantive value for 'newErrPref'.

newContext          string
   - This is the error context information associated with the
     new error prefix ('newErrPref'). This parameter is
     optional and will accept an empty string.

-----------------------------------------------------------------

Return Values

string
   - This method will return the consolidated error prefix text.

     The error prefix text is designed to be configured at the
     beginning of error messages and is most often used to
     document the thread of code execution by listing the calling
     sequence for specific functions and methods.

-----------------------------------------------------------------

Usage Examples

errorPrefix = ErrPref{}.EPrefCtx(
                         oldErrPref, // Assuming this is the old
                                      // error prefix
                         newErrPref,
                         newContext)

func (ErrPref) EPrefOld

func (ePref ErrPref) EPrefOld(
	oldErrPref string) string

EPrefOld - Receives an old or preexisting error prefix string which is parsed into error prefix and error context components and returned as a properly formatted error prefix string.

Error prefix text is designed to be configured at the beginning of error messages and is most often used to document the thread of code execution by listing the calling sequence for a specific list of functions and methods.

The error context string is designed to provide additional information about the function or method identified by the associated error prefix string. Typical context information might include variable names, variable values and additional details on function execution.

- IMPORTANT -

The last line of error prefix strings returned by the methods on this type are NOT terminated with a new line character ('\n'). That means that the last line of error prefix strings will never end with a new line character ('\n').

If you prefer that the last line of error prefix strings be terminated with a new line character ('\n'), you have two options:

  1. Add the terminating new line character in your code.

    OR

  2. Use the Error Prefix Data Transfer Object type 'ErrPrefixDto'.

----------------------------------------------------------------

Input Parameters

oldErrPref          string
   - This includes the previous or preexisting error prefix
     string. This string will be parsed into error prefix
     and error context components before being converted into
     a single, formatted string containing error prefix and
     error context information.

     This string should consist of a series of error prefix
     strings. Error prefixes should be delimited by either a
     new line character ('\n') or the in-line delimiter string,
     " - ".

     If this string contains associated error context strings
     as well, they should be delimited with either a new line
     delimiter string, "\n :  " or an in-line delimiter string,
     " : ".

-----------------------------------------------------------------

Return Values

string
   - This method will return the consolidated error prefix text.

     The error prefix text is designed to be configured at the
     beginning of error messages and is most often used to
     document the thread of code execution by listing the calling
     sequence for specific functions and methods.

-----------------------------------------------------------------

Usage Examples

errorPrefix = ErrPref{}.EPrefOld(
                         oldErrPref) // Assuming this is the old
                                     // or preexisting error
                                     // prefix

func (ErrPref) FmtStr

func (ePref ErrPref) FmtStr(
	errPref string) string

FmtStr - Returns a formatted text representation of all error prefix and error context information contained in the input parameter string, 'errPref'.

Error prefix text is designed to be configured at the beginning of error messages and is most often used to document the thread of code execution by listing the calling sequence for a specific list of functions and methods.

The error context descriptive text provides additional information about the function or method identified in the associated error prefix string. Typical context information might include variable names, variable values and further details on function execution.

------------------------------------------------------------------------

Input Parameters

errPref             string
   - This string holds a series of error prefix and error
     context text elements. Each element must be separated by
     either a new line character '\n' or the string " - ". This
     will format these elements and return them in a properly
     configured error prefix string for text presentation.

------------------------------------------------------------------------

Return Values

string
   - A string containing properly formatted error prefix and
     error context pairs configured for configuration in an
     error message.

func (ErrPref) GetLastEPref

func (ePref ErrPref) GetLastEPref(
	oldErrPrefix string) string

GetLastEPref - Returns the last error prefix, error context pair from a string consisting of a series of error prefix, error context pairs.

func (ErrPref) GetMaxErrPrefTextLineLength

func (ePref ErrPref) GetMaxErrPrefTextLineLength() (
	maxErrPrefixStringLength uint)

GetMaxErrPrefTextLineLength - Returns the current maximum number of characters allowed in an error prefix text line output display.

To change or reset this maximum limit value, see method:

ErrPref.SetMaxErrPrefTextLineLength().

------------------------------------------------------------------------

Input Parameters

--- NONE ---

------------------------------------------------------------------------

Return Values

maxErrPrefixStringLength      uint
   - This method will return an unsigned integer value
     specifying the maximum number of characters allowed
     in an error prefix text display line.

func (ErrPref) SetCtxt

func (ePref ErrPref) SetCtxt(
	oldErrPref string,
	newErrContext string) string

SetCtxt - Sets or resets the error context for the last error prefix. This operation either adds, or replaces, the error context string associated with the last error prefix in input parameter, 'oldErrPref'.

If the last error prefix already has an error context string, it will be replaced by input parameter, 'newErrContext'.

If the last error prefix does NOT have an associated error context, this new error context string will be associated with that error prefix.

- IMPORTANT -

The last line of error prefix strings returned by the methods on this type are NOT terminated with a new line character ('\n'). That means that the last line of error prefix strings will never end with a new line character ('\n').

If you prefer that the last line of error prefix strings be terminated with a new line character ('\n'), you have two options:

  1. Add the terminating new line character in your code.

    OR

  2. Use the Error Prefix Data Transfer Object type 'ErrPrefixDto'.

----------------------------------------------------------------

Input Parameters

oldErrPref          string
   - This includes the previous or preexisting error prefix
     string. This string will be parsed into error prefix
     and error context components before being converted into
     a single, formatted string containing error prefix and
     error context information.

     This string should consist of a series of error prefix
     strings. Error prefixes should be delimited by either a
     new line character ('\n') or the in-line delimiter string,
     " - ".

     If this string contains associated error context strings
     as well, they should be delimited with either a new line
     delimiter string, "\n :  " or an in-line delimiter string,
     " : ".

newErrContext       string
   - This string holds the new error context information. If
     the last error prefix in 'oldErrPref' already has an
     associated error context, that context will be deleted and
     replaced by 'newErrContext'. If, however, the last error
     prefix in 'oldErrPref' does NOT have an associated error
     context, this 'newErrContext' string will be added and
     associated with the last error prefix in 'oldErrPref'.

-----------------------------------------------------------------

Return Values

string
   - This method will return the consolidated error prefix text.

     The error prefix text is designed to be configured at the
     beginning of error messages and is most often used to
     document the thread of code execution by listing the calling
     sequence for specific functions and methods.

func (ErrPref) SetMaxErrPrefTextLineLength

func (ePref ErrPref) SetMaxErrPrefTextLineLength(
	maxErrPrefixTextLineLength uint)

SetMaxErrPrefTextLineLength - Sets the maximum limit on the number of characters allowed in an error prefix text line output display.

-IMPORTANT - Setting this value will control the maximum character limit not only for this ErrPref instance, but will also control all that limit for all other instances of ErrPref created in this session.

----------------------------------------------------------------

Input Parameters

maxErrPrefixTextLineLength      uint
   - This unsigned integer value will be used to set the
     maximum number of characters allowed in a text display
     line for error prefix information.

     If 'maxErrPrefixTextLineLength' is set to a value of zero
     (0), this method will take no action and return.

-----------------------------------------------------------------

Return Values

--- NONE ---

func (ErrPref) SetMaxErrPrefTextLineLengthToDefault

func (ePref ErrPref) SetMaxErrPrefTextLineLengthToDefault()

SetMaxErrPrefTextLineLengthToDefault - Maximum Error Prefix Line Length is the maximum limit on the number of characters allowed in a single error prefix text line.

This method resets that maximum limit to its default value of 40-characters.

type ErrPrefixDelimiters

type ErrPrefixDelimiters struct {
	// contains filtered or unexported fields
}

func (*ErrPrefixDelimiters) CopyIn

func (ePrefDelims *ErrPrefixDelimiters) CopyIn(
	incomingDelimiters *ErrPrefixDelimiters,
	ePrefix string) error

CopyIn - Receives an instance of type ErrPrefixDelimiters and proceeds to copy the internal member data variable values to the current ErrPrefixDelimiters instance.

----------------------------------------------------------------

Input Parameters

incomingDelimiters         *ErrPrefixDelimiters
   - A pointer to an instance of ErrPrefixDelimiters. This method
     will NOT change the values of internal member variables
     contained in this instance.

     All data values in this ErrPrefixDelimiters instance will
     be copied to current ErrPrefixDelimiters instance
     ('ePrefDelims').

     If this ErrPrefixDelimiters instance proves to be invalid,
     an error will be returned.

ePrefix                    string
   - This is an error prefix which is included in all returned
     error messages. Usually, it contains the names of the calling
     method or methods. Note: Be sure to leave a space at the end
     of 'ePrefix'.

------------------------------------------------------------------------

Return Values

err                        error
   - If this method completes successfully, the returned error Type
     is set to 'nil'. If errors are encountered during processing,
     the returned error Type will encapsulate an error message.
     Note that this error message will incorporate the method
     chain and text passed by input parameter, 'ePrefix'.

func (*ErrPrefixDelimiters) CopyOut

func (ePrefDelims *ErrPrefixDelimiters) CopyOut(
	ePrefix string) (
	ErrPrefixDelimiters,
	error)

CopyOut - Creates and returns a deep copy of the current ErrPrefixDelimiters. After completion of this operation, the returned copy and the current ErrPrefixDelimiters instance are identical in all respects.

------------------------------------------------------------------------

Input Parameters

ePrefix             string
   - This is an error prefix which is included in all returned
     error messages. Usually, it contains the names of the calling
     method or methods. Note: Be sure to leave a space at the end
     of 'ePrefix'.

------------------------------------------------------------------------

Return Values

ErrPrefixDelimiters
   - If this method completes successfully, a deep copy of the
     current ErrPrefixDelimiters instance will be returned through
     this parameter as a completely new instance of
     ErrPrefixDelimiters.

error
   - If this method completes successfully, the returned error Type
     is set to 'nil'. If errors are encountered during processing,
     the returned error Type will encapsulate an error message.
     Note that this error message will incorporate the method
     chain and text passed by input parameter, 'ePrefix'. The
     'ePrefix' text will be prefixed to the beginning of the returned
     error message.

func (*ErrPrefixDelimiters) GetInLineContextDelimiter

func (ePrefDelims *ErrPrefixDelimiters) GetInLineContextDelimiter() string

GetInLineContextDelimiter - Returns ePrefDelims.inLineContextDelimiter

func (*ErrPrefixDelimiters) GetInLinePrefixDelimiter

func (ePrefDelims *ErrPrefixDelimiters) GetInLinePrefixDelimiter() string

GetInLinePrefixDelimiter - Returns ePrefDelims.inLinePrefixDelimiter

func (*ErrPrefixDelimiters) GetLengthInLineContextDelimiter

func (ePrefDelims *ErrPrefixDelimiters) GetLengthInLineContextDelimiter() uint

GetLengthInLineContextDelimiter - Returns the number of characters in the 'In Line Context Delimiter' string as an unsigned integer.

func (*ErrPrefixDelimiters) GetLengthInLinePrefixDelimiter

func (ePrefDelims *ErrPrefixDelimiters) GetLengthInLinePrefixDelimiter() uint

GetLengthInLinePrefixDelimiter - Returns the number of characters in the 'In Line Prefix Delimiter' string as an unsigned integer.

func (*ErrPrefixDelimiters) GetLengthNewLineContextDelimiter

func (ePrefDelims *ErrPrefixDelimiters) GetLengthNewLineContextDelimiter() uint

GetLengthNewLineContextDelimiter - Returns the number of characters in the 'New Line Context Delimiter' string as an unsigned integer.

func (*ErrPrefixDelimiters) GetLengthNewLinePrefixDelimiter

func (ePrefDelims *ErrPrefixDelimiters) GetLengthNewLinePrefixDelimiter() uint

GetLengthNewLinePrefixDelimiter - Returns the number of characters in the 'New Line Prefix Delimiter' string as an unsigned integer.

func (*ErrPrefixDelimiters) GetNewLineContextDelimiter

func (ePrefDelims *ErrPrefixDelimiters) GetNewLineContextDelimiter() string

GetNewLineContextDelimiter - Returns ePrefDelims.newLineContextDelimiter

func (*ErrPrefixDelimiters) GetNewLinePrefixDelimiter

func (ePrefDelims *ErrPrefixDelimiters) GetNewLinePrefixDelimiter() string

GetNewLinePrefixDelimiter - Returns ePrefDelims.newLinePrefixDelimiter

func (*ErrPrefixDelimiters) IsValidInstance

func (ePrefDelims *ErrPrefixDelimiters) IsValidInstance(
	ePrefix string) bool

IsValidInstance - Returns a boolean flag signalling whether the current ErrPrefixDelimiters instance is valid, or not.

If this method returns a boolean value of 'false', it signals that the current ErrPrefixDelimiters instance is invalid.

If this method returns a boolean value of 'true', it signals that the current ErrPrefixDelimiters instance is valid in all respects.

----------------------------------------------------------------

Input Parameters

--- NONE ---

-----------------------------------------------------------------

Return Values

bool
   - This boolean flag signals whether the current
     ErrPrefixDelimiters instance is valid.

     If this method returns a value of 'false', it signals that
     the current ErrPrefixDelimiters instance is invalid.

     If this method returns a value of 'true', it signals that
     the current ErrPrefixDelimiters instance is valid in all
     respects.

func (*ErrPrefixDelimiters) IsValidInstanceError

func (ePrefDelims *ErrPrefixDelimiters) IsValidInstanceError(
	ePrefix string) error

IsValidInstanceError - Returns an error type signalling whether the current ErrPrefixDelimiters instance is valid, or not.

If this method returns an error value NOT equal to 'nil', it signals that the current ErrPrefixDelimiters instance is invalid.

If this method returns an error value which IS equal to 'nil', it signals that the current ErrPrefixDelimiters instance is valid in all respects.

----------------------------------------------------------------

Input Parameters

ePrefix             string
   - This is an error prefix which is included in all returned
     error messages. Usually, it contains the names of the calling
     method or methods. Note: Be sure to leave a space at the end
     of 'ePrefix'.

-----------------------------------------------------------------

Return Values

error
   - If this returned error type is set equal to 'nil', it
     signals that the current ErrPrefixDelimiters is valid in
     all respects.

     If this returned error type is NOT equal to 'nil', it
     signals that the current ErrPrefixDelimiters is invalid.

func (*ErrPrefixDelimiters) SetInLineContextDelimiter

func (ePrefDelims *ErrPrefixDelimiters) SetInLineContextDelimiter(
	inLineContextDelimiter string)

SetInLineContextDelimiter - Sets ePrefDelims.inLineContextDelimiter

This method also sets the line length value for this parameter and stores it in an internal member variable. This value may be accessed through a 'Getter' method.

func (*ErrPrefixDelimiters) SetInLinePrefixDelimiter

func (ePrefDelims *ErrPrefixDelimiters) SetInLinePrefixDelimiter(
	inLinePrefixDelimiter string)

SetInLinePrefixDelimiter - Sets ePrefDelims.inLinePrefixDelimiter

This method also sets the line length value for this parameter and stores it in an internal member variable. This value may be accessed through a 'Getter' method.

func (*ErrPrefixDelimiters) SetLineLengthValues

func (ePrefDelims *ErrPrefixDelimiters) SetLineLengthValues()

SetLineLengthValues - Automatically calculates, sets and stores the line lengths for all delimiters. These values are stored in internal member variables and may be accessed using 'Getter' methods.

func (*ErrPrefixDelimiters) SetNewLineContextDelimiter

func (ePrefDelims *ErrPrefixDelimiters) SetNewLineContextDelimiter(
	newLineContextDelimiter string)

SetNewLineContextDelimiter - Sets ePrefDelims.newLineContextDelimiter

This method also sets the line length value for this parameter and stores it in an internal member variable. This value may be accessed through a 'Getter' method.

func (*ErrPrefixDelimiters) SetNewLinePrefixDelimiter

func (ePrefDelims *ErrPrefixDelimiters) SetNewLinePrefixDelimiter(
	newLinePrefixDelimiter string)

SetNewLinePrefixDelimiter - Sets ePrefDelims.newLinePrefixDelimiter

This method also sets the line length value for this parameter and stores it in an internal member variable. This value may be accessed through a 'Getter' method.

type ErrPrefixDto

type ErrPrefixDto struct {
	// contains filtered or unexported fields
}

ErrPrefixDto - Error Prefix Data Transfer Object. This type encapsulates and formats error prefix and error context strings.

The error prefix text is designed to be configured at the beginning of error messages and is most often used to document the thread of code execution by listing the calling sequence for specific functions and methods.

The error context string is designed to provide additional error context information associated with the currently executing function or method. Typical context information might include variable names, variable values and additional details on function execution.

ErrPrefixDto is similar in function to type 'ErrPref'. However, unlike 'ErrPref', ErrPrefixDto is configured encapsulate and transmit error prefix information between methods. 'ErrPref' only returns strings. This type, ErrPrefixDto, returns an object which may be exchanged between methods.

func (*ErrPrefixDto) AddEPrefCollectionStr

func (ePrefDto *ErrPrefixDto) AddEPrefCollectionStr(
	errorPrefixCollectionStr string) (
	numberOfCollectionItemsParsed int)

AddEPrefCollectionStr - Receives a string containing one or more error prefix and error context pairs. This error prefix information is parsed and added to the internal store of error prefix elements.

Upon completion this method returns an integer value identifying the number of error prefix elements successfully parsed and added to internal error prefix storage.

----------------------------------------------------------------

Input Parameters

errorPrefixCollectionStr      string
   - A string consisting of a series of error prefix strings.
     Error prefixes should be delimited by either a new line
     character ('\n') or the in-line delimiter string, " - ".

     If the collection string contains error context strings
     as well, they should be delimited with either a new line
     delimiter string, "\n :  " or an in-line delimiter string,
     " : ".

-----------------------------------------------------------------

Return Values

numberOfCollectionItemsParsed int
   - This returned integer value contains the number of error
     prefix elements parsed from input parameter
     'errorPrefixCollection' and added to the internal store
     of error prefix elements.

func (*ErrPrefixDto) AddEPrefStrings added in v1.5.0

func (ePrefDto *ErrPrefixDto) AddEPrefStrings(
	twoDStrArray [][2]string)

AddEPrefStrings - Adds error prefix information extracted from a passed two-dimensional string array to the internal ErrorPrefixInfo collection managed by this ErrPrefixDto instance.

If input parameter 'twoDStrArray' is 'nil' or empty, this method will take no action an exit.

func (*ErrPrefixDto) Copy added in v1.2.0

func (ePrefDto *ErrPrefixDto) Copy() ErrPrefixDto

Copy - Creates a deep copy of the data fields contained in the current ErrPrefixDto instance, and returns that data as a as a new instance of ErrPrefixDto.

------------------------------------------------------------------------

Input Parameters

--- NONE ---

------------------------------------------------------------------------

Return Values

ErrPrefixDto
   - If this method completes successfully, a deep copy of the
     current ErrPrefixDto instance will be returned through
     this parameter as a pointer to a new instance of
     ErrPrefixDto.

func (*ErrPrefixDto) CopyIn

func (ePrefDto *ErrPrefixDto) CopyIn(
	inComingErrPrefixDto *ErrPrefixDto,
	eMsg string) error

CopyIn - Copies the data fields from an incoming instance of ErrPrefixDto ('inComingErrPrefixDto') to the data fields of the current ErrPrefixDto instance ('ePrefDto').

All of the data fields in current ErrPrefixDto instance ('ePrefDto') will be modified and overwritten.

----------------------------------------------------------------

Input Parameters

inComingErrPrefixDto       *ErrPrefixDto
   - A pointer to an instance of ErrPrefixDto. This method
     will NOT change the values of internal member variables
     contained in this instance.

     All data values in this ErrPrefixDto instance will be
     copied to current ErrPrefixDto instance
     ('ePrefDto').

eMsg                       string
   - This is an error prefix which is included in all returned
     error messages. Usually, it contains the names of the calling
     method or methods. Note: Be sure to leave a space at the end
     of 'eMsg'.

------------------------------------------------------------------------

Return Values

err                        error
   - If this method completes successfully, the returned error Type
     is set to 'nil'. If errors are encountered during processing,
     the returned error Type will encapsulate an error message.
     Note that this error message will incorporate the method
     chain and text passed by input parameter, 'eMsg'.

func (*ErrPrefixDto) CopyOut

func (ePrefDto *ErrPrefixDto) CopyOut(
	eMsg string) (
	ErrPrefixDto,
	error)

CopyOut - Creates a deep copy of the data fields contained in the current ErrPrefixDto instance, and returns that data as a new instance of ErrPrefixDto.

------------------------------------------------------------------------

Input Parameters

eMsg                string
   - This is an error prefix which is included in all returned
     error messages. Usually, it contains the names of the calling
     method or methods. Note: Be sure to leave a space at the end
     of 'eMsg'.

------------------------------------------------------------------------

Return Values

ErrPrefixDto
   - If this method completes successfully, a deep copy of the
     current ErrPrefixDto instance will be returned through
     this parameter as a completely new instance of
     ErrPrefixDto.

error
   - If this method completes successfully, the returned error Type
     is set to 'nil'. If errors are encountered during processing,
     the returned error Type will encapsulate an error message.
     Note that this error message will incorporate the method
     chain and text passed by input parameter, 'eMsg'. The
     'eMsg' text will be prefixed to the beginning of the returned
     error message.

func (*ErrPrefixDto) CopyPtr added in v1.4.0

func (ePrefDto *ErrPrefixDto) CopyPtr() *ErrPrefixDto

CopyPtr - Creates a deep copy of the data fields contained in the current ErrPrefixDto instance, and returns that data as a pointer to a new instance of ErrPrefixDto.

------------------------------------------------------------------------

Input Parameters

--- NONE ---

------------------------------------------------------------------------

Return Values

*ErrPrefixDto
   - If this method completes successfully, a deep copy of the
     current ErrPrefixDto instance will be returned through
     this parameter as a pointer to a new instance of
     ErrPrefixDto.

func (*ErrPrefixDto) EmptyEPrefCollection

func (ePrefDto *ErrPrefixDto) EmptyEPrefCollection()

EmptyEPrefCollection - All instances of ErrPrefixDto store error prefix information internally in an array of ErrorPrefixInfo objects. This method will delete or empty the current ErrorPrefixInfo array and initialize it to a zero length array.

Effectively, this will delete all existing error prefix information stored in the current ErrPrefixDto instance.

func (*ErrPrefixDto) Equal

func (ePrefDto *ErrPrefixDto) Equal(
	ePrefixDto2 *ErrPrefixDto) bool

Equal - Returns a boolean flag signaling whether the data values contained in the current ErrPrefixDto instance are equal to those contained in input parameter, 'ePrefixDto2'

------------------------------------------------------------------------

Input Parameters

ePrefixDto2         *ErrPrefixDto
   - A pointer to an instance of ErrPrefixDto. The data values
     contained in this instance will be compared to those
     contained in the current ErrPrefixDto instance (ePrefDto)
     to determine equality.

------------------------------------------------------------------------

Return Values

bool
   - A boolean flag signaling whether the data values contained
     in the current ErrPrefixDto instance are equal to those
     contained in input parameter 'ePrefixDto2'. If the data
     values are equal in all respects, this returned boolean
     value will be set to 'true'.

func (*ErrPrefixDto) GetEPrefCollection

func (ePrefDto *ErrPrefixDto) GetEPrefCollection() []ErrorPrefixInfo

GetEPrefCollection - Returns a deep copy of the current error prefix collection maintained by this ErrPrefixDto instance.

func (*ErrPrefixDto) GetEPrefCollectionLen

func (ePrefDto *ErrPrefixDto) GetEPrefCollectionLen() int

GetEPrefCollectionLen - Returns the number of elements in the error prefix array. Effectively this is a count of the number of error prefix elements maintained by this ErrPrefixDto instance.

----------------------------------------------------------------

Input Parameters

--- NONE ---

-----------------------------------------------------------------

Return Values

int
   - This integer value represents the number of separate error
     prefix elements maintained by this ErrPrefixDto instance.

func (*ErrPrefixDto) GetEPrefStrings added in v1.5.0

func (ePrefDto *ErrPrefixDto) GetEPrefStrings() [][2]string

GetEPrefStrings - Returns a two dimensional slice of Error Prefix and Context strings.

The Error Prefix is always in the [x][0] position. The Error Context string is always in the [x][1] position. The Error Context string may be an empty string.

func (*ErrPrefixDto) GetIsLastLineTerminatedWithNewLine

func (ePrefDto *ErrPrefixDto) GetIsLastLineTerminatedWithNewLine() bool

GetIsLastLineTerminatedWithNewLine - Returns the boolean flag which determines whether the last line of error prefix strings returned by this ErrPrefixDto instance will be terminated with a new line character ('\n').

By default, the last line of error prefix strings returned by the method 'ErrPrefixDto.String()' DO NOT end with a new line character ('\n'). In other words, the last line of returned error prefix strings ARE NOT, by default, terminated with new line characters ('\n').

If terminating the last line of error prefix strings with a new line character ('\n') is a preferred option, use the method 'SetIsLastLineTermWithNewLine()' to configure this feature.

----------------------------------------------------------------

Input Parameters

--- NONE ---

-----------------------------------------------------------------

Return Values

bool
   - If this return parameter is set to 'true', it signals that
     the last line of all error prefix strings returned by this
     ErrPrefixDto instance WILL BE terminated with a new line
     character ('\n').

func (*ErrPrefixDto) GetMaxErrPrefTextLineLength

func (ePrefDto *ErrPrefixDto) GetMaxErrPrefTextLineLength() uint

GetMaxErrPrefTextLineLength - Returns the maximum limit on the number of characters allowed in an error prefix text line output for display purposes.

This unsigned integer value controls the maximum character limit for this specific ErrPrefixDto instance. This maximum limit will remain in force for the life of this ErrPrefixDto instance or until a call is made to the method 'SetMaxTextLineLen()' which is used to change the value.

----------------------------------------------------------------

Input Parameters

--- NONE ---

-----------------------------------------------------------------

Return Values

uint
   - This unsigned integer specifies the maximum limit on the
     number of characters allowed in an error prefix text line
     output for display purposes.

func (*ErrPrefixDto) MergeErrPrefixDto

func (ePrefDto *ErrPrefixDto) MergeErrPrefixDto(
	incomingErrPrefixDto *ErrPrefixDto)

MergeErrPrefixDto - Receives a pointer to another ErrPrefixDto object and proceeds to add the error prefix collection to that of the current ErrPrefixDto instance.

This means that the error prefix collection for 'incomingErrPrefixDto' will be added to the end of the ePrefDto collection.

func (ErrPrefixDto) New

func (ePrefDto ErrPrefixDto) New() ErrPrefixDto

New - Returns a new and properly initialized instance of ErrPrefixDto.

----------------------------------------------------------------

Input Parameters

-- NONE --

-----------------------------------------------------------------

Return Values

ErrPrefixDto
   - This method will return a new, properly initialized
     instance of ErrPrefixDto. The ErrorPrefixInfo collection
     encapsulated by the new instance will be an empty
     collection containing zero elements.

func (ErrPrefixDto) NewEPrefCollection

func (ePrefDto ErrPrefixDto) NewEPrefCollection(
	errorPrefixCollection string) (
	numberOfCollectionItemsParsed int,
	newErrPrefixDto ErrPrefixDto)

NewEPrefCollection - Returns a new and properly initialized instance of ErrPrefixDto. This method receives a string containing one or more error prefix and error context pairs. This error prefix information is parsed and stored internally as individual error prefix elements.

Upon completion this method returns an integer value identifying the number of error prefix elements successfully parsed and stored for future use.

----------------------------------------------------------------

Input Parameters

errorPrefixCollection         string
   - A string consisting of a series of error prefix strings.
     Error prefixes should be delimited by either a new line
     character ('\n') or the in-line delimiter string, " - ".

     If the collection string contains error context strings
     as well, they should be delimited with either a new line
     delimiter string, "\n :  " or an in-line delimiter string,
     " : ".

-----------------------------------------------------------------

Return Values

numberOfCollectionItemsParsed int
   - This returned integer value contains the number of error
     prefix elements parsed from input parameter
     'errorPrefixCollection' and stored internally for future
     use.

newErrPrefixDto               ErrPrefixDto
   - This method will return a newly created instance of
     ErrPrefixDto configured with the error prefix information
     parsed from input parameter, 'errorPrefixCollection'.

func (ErrPrefixDto) NewEPrefOld

func (ePrefDto ErrPrefixDto) NewEPrefOld(
	oldErrPrefix string) ErrPrefixDto

NewEPrefOld - Returns a new and properly initialized instance of ErrPrefixDto. The returned ErrPrefixDto instance will be configured with error prefix information extracted from input parameter, 'oldErrPrefix'.

----------------------------------------------------------------

Input Parameters

oldErrPrefix        string
   - This includes the previous or preexisting error prefix
     string which will encapsulate one or more error prefix
     elements. This string will be parsed into error prefix and
     error context components and stored in the returned
     ErrPrefixDto instance.

     This string should consist of a series of error prefix
     strings. Error prefixes should be delimited by either a
     new line character ('\n') or the in-line delimiter string,
     " - ".

     If this string contains associated error context strings
     as well, they should be delimited with either a new line
     delimiter string, "\n :  " or an in-line delimiter string,
     " : ".

-----------------------------------------------------------------

Return Values

ErrPrefixDto
   - This method will return a new, properly initialized
     instance of ErrPrefixDto containing error prefix
     information extracted from input parameter,
     'oldErrPrefix'.

func (ErrPrefixDto) NewFromIErrorPrefix added in v1.3.0

func (ePrefDto ErrPrefixDto) NewFromIErrorPrefix(
	iEPref IErrorPrefix) ErrPrefixDto

NewFromIErrorPrefix - Receives an object which implements the IErrorPrefix interface and returns a new, populated instance of ErrPrefixDto.

If the IErrorPrefix ErrorPrefixInfo collection is empty, this method will return an empty instance of ErrPrefixDto.

----------------------------------------------------------------

Input Parameters

iEPref              IErrorPrefix
   - An object which implements the IErrorPrefix interface.
     Information extracted from this object will be used to
     replicate error prefix information in a new instance of
     ErrPrefixDto.

-----------------------------------------------------------------

Return Values

ErrPrefixDto
   - This method will return a instance of ErrPrefixDto
     containing a duplicate of error prefix information
     extracted from input parameter 'iEPref'.

func (ErrPrefixDto) NewIBasicErrorPrefix added in v1.5.0

func (ePrefDto ErrPrefixDto) NewIBasicErrorPrefix(
	iEPref IBasicErrorPrefix,
	newErrPrefix string,
	newErrContext string) (
	*ErrPrefixDto,
	error)

NewIBasicErrorPrefix - Receives an object which implements the IBasicErrorPrefix interface and returns a new, populated instance of ErrPrefixDto.

----------------------------------------------------------------

Input Parameters

iEPref              IBasicErrorPrefix
   - An object which implements the IBasicErrorPrefix
     interface.

     This interface contains one method, 'GetEPrefStrings()'.
     This single method returns a two dimensional array of
     strings. Each 2-Dimensional array element holds a separate
     string for error prefix and error context.

     Information extracted from this object will be used to
     generate error prefix information in a new instance of
     ErrPrefixDto.

     Be advised, if 'iEPref' is nil, this method will return
     an error

newErrPrefix        string
   - A new error prefix represents typically identifies the
     function or method which is currently executing. This
     information is used to document source code execution flow
     in error messages.

     This error prefix information will be added to the
     internal collection of error prefixes maintained by the
     new instance of ErrPrefixDto returned by this method.

     If this parameter is set to an empty string, no additional
     error prefix information will be added to the returned
     instance of ErrPrefixDto.

newErrContext       string
   - This is error context information associated with the new
     error prefix ('newErrPrefix') string described above.

     This parameter is optional and will accept an empty
     string.

-----------------------------------------------------------------

Return Values

*ErrPrefixDto
   - If this method completes successfully, it will return a
     pointer to a new instance of ErrPrefixDto containing a
     duplicate of error prefix and error context information
     extracted from input parameter 'iEPref' plus new error
     prefix information supplied by parameters, 'newErrPrefix'
     and 'newErrContext'.

error
   - If this method completes successfully, the returned error
     Type is set equal to 'nil'.

     If errors are encountered during processing, the returned
     error Type will encapsulate an error message.

     In the event of an error, the value of parameter
     'newErrPrefix' will be prefixed and attached to the
     beginning of the error message

func (ErrPrefixDto) NewIEmpty added in v1.5.0

func (ePrefDto ErrPrefixDto) NewIEmpty(
	iEPref interface{},
	newErrPrefix string,
	newErrContext string) (
	*ErrPrefixDto,
	error)

NewIEmpty - Receives an empty interface. If that empty interface is convertible to one of the 10-valid types listed below, this method then proceeds to create and return a pointer to a new instance of ErrPrefixDto.

----------------------------------------------------------------

Input Parameters

iEPref              interface{}
   - An empty interface containing one of the 10-valid type
     listed below. Any one of these valid types will generate
     valid error prefix and error context information.

     The error prefix and error context information for this
     new ErrPrefixDto object will be extracted from input
     parameter, 'iEPref'. 'iEPref' is an empty interface which
     must be convertible to one of the following valid types:

     1. nil               - A nil value is valid and generates an empty
                            collection of error prefix and error context
                            information.

     2. Stringer          - The Stringer interface from the 'fmt' package.
                            This interface has only one method:
                                 type Stringer interface {
                                    String() string
                                 }

     3. string            - A string containing error prefix information.

     4. []string          - A one-dimensional slice of strings containing
                            error prefix information.

     5. [][2]string       - A two-dimensional slice of strings
                            containing error prefix and error context
                            information.

     6. strings.Builder   - An instance of strings.Builder. Error prefix
                            information will be imported into the new
                            returned instance of ErrPrefixDto.

     7  *strings.Builder  - A pointer to an instance of strings.Builder.
                            Error prefix information will be imported into
                            the new returned instance of ErrPrefixDto.

     8. ErrPrefixDto      - An instance of ErrPrefixDto. The
                            ErrorPrefixInfo from this object will be
                            copied to the new returned instance of
                            ErrPrefixDto.

     9. *ErrPrefixDto     - A pointer to an instance of ErrPrefixDto.
                            ErrorPrefixInfo from this object will be
                            copied to 'errPrefDto'.

    10. IBasicErrorPrefix - An interface to a method generating
                            a two-dimensional slice of strings
                            containing error prefix and error
                            context information.

     Any types not listed above will be considered invalid and
     trigger the return of an error.

newErrPrefix        string
   - A new error prefix represents typically identifies the
     function or method which is currently executing. This
     information is used to document source code execution flow
     in error messages.

     This error prefix information will be added to the
     internal collection of error prefixes maintained by the
     new instance of ErrPrefixDto returned by this method.

     If this parameter is set to an empty string, no additional
     error prefix information will be added to the returned
     instance of ErrPrefixDto.

newErrContext       string
   - This is error context information associated with the new
     error prefix ('newErrPrefix') string described above.

     This parameter is optional and will accept an empty
     string.

-----------------------------------------------------------------

Return Values

*ErrPrefixDto
   - If this method completes successfully, it will return a
     pointer to a new instance of ErrPrefixDto containing a
     duplicate of error prefix and error context information
     extracted from input parameter 'iEPref' plus new error
     prefix information supplied by parameters, 'newErrPrefix'
     and 'newErrContext'.

error
   - If this method completes successfully, the returned error
     Type is set equal to 'nil'.

     If errors are encountered during processing, the returned
     error Type will encapsulate an error message.

     In the event of an error, the value of parameter
     'newErrPrefix' will be prefixed and attached to the
     beginning of the error message

func (ErrPrefixDto) Ptr added in v1.2.0

func (ePrefDto ErrPrefixDto) Ptr() *ErrPrefixDto

Ptr - Returns a pointer to a new and properly initialized instance of ErrPrefixDto.

----------------------------------------------------------------

Input Parameters

-- NONE --

-----------------------------------------------------------------

Return Values

ErrPrefixDto
   - This method will return a pointer to a new and properly
     initialized instance of ErrPrefixDto.

func (*ErrPrefixDto) SetCtx

func (ePrefDto *ErrPrefixDto) SetCtx(
	newErrContext string)

SetCtx - Sets or resets the error context for the last error prefix. This operation either adds, or replaces, the error context string associated with the last error prefix the current list of error prefixes maintained by this instance.

If the last error prefix already has an error context string, it will be replaced by input parameter, 'newErrContext'.

If the last error prefix does NOT have an associated error context, this new error context string will be associated with that error prefix.

If the internal list of error prefixes is currently empty, this method will take no action and exit.

If the input parameter string 'newErrContext' is 'empty' (zero length string), this method will delete the last error context associated with the last error prefix in the error prefix collection.

----------------------------------------------------------------

Input Parameters

newErrContext       string
   - This string holds the new error context information. If
     the last error prefix in internal storage already has an
     associated error context, that context will be deleted and
     replaced by 'newErrContext'. If, however, the last error
     prefix does NOT have an associated error context, this
     'newErrContext' string will be added and associated with
     that last error prefix.

     If this string is 'empty' (zero length string), this
     method will delete the last error context associated with
     the last error prefix in the error prefix collection.

-----------------------------------------------------------------

Return Values

--- NONE ---

func (*ErrPrefixDto) SetCtxEmpty added in v1.3.0

func (ePrefDto *ErrPrefixDto) SetCtxEmpty()

SetCtxEmpty - Deletes the last error context for the last error prefix in this instance of ErrPrefixDto.

----------------------------------------------------------------

Input Parameters

--- NONE ---

-----------------------------------------------------------------

Return Values

--- NONE ---

func (*ErrPrefixDto) SetEPref

func (ePrefDto *ErrPrefixDto) SetEPref(
	newErrPrefix string)

SetEPref - Adds an error prefix string to the list of previous error prefix strings maintained by this instance of ErrPrefixDto.

The error prefix text is designed to be configured at the beginning of error messages and is most often used to document the thread of code execution by listing the calling sequence for specific functions and methods.

This method is designed to process a single error prefix string passed in input parameter 'ErrPrefixDto'. If this string contains multiple error prefixes, use method 'ErrPrefixDto.SetEPrefOld()'.

----------------------------------------------------------------

Input Parameters

newErrPrefix        string
   - The new error prefix represents typically identifies
     the function or method which is currently executing. This
     information is used to document source code execution flow
     in error messages.

     This new error prefix will be added to the internal list
     of error prefixes maintained by this ErrPrefixDto
     instance.

-----------------------------------------------------------------

Return Values

--- NONE ---

func (*ErrPrefixDto) SetEPrefCollection

func (ePrefDto *ErrPrefixDto) SetEPrefCollection(
	newEPrefCollection []ErrorPrefixInfo)

func (*ErrPrefixDto) SetEPrefCtx

func (ePrefDto *ErrPrefixDto) SetEPrefCtx(
	newErrPrefix string,
	newErrContext string)

SetEPrefCtx - Adds an error prefix and an error context string to the list of previous error prefix/context information.

Error prefix text is designed to be configured at the beginning of error messages and is most often used to document the thread of code execution by listing the calling sequence for a specific list of functions and methods.

The error context string is designed to provide additional information about the function or method identified by the associated error prefix string. Typical context information might include variable names, variable values and additional details on function execution.

----------------------------------------------------------------

Input Parameters

newErrPrefix        string
   - The new error prefix represents typically identifies
     the function or method which is currently executing. This
     information is used to document source code execution flow
     in error messages.

     This method is designed to process a single new error prefix
     string. To process a collection of error prefix strings, see
     method 'ErrPrefixDto.SetEPrefOld()'.

newErrContext       string
   - This is the error context information associated with the
     new error prefix ('newErrPrefix'). This parameter is
     optional and will accept an empty string.

-----------------------------------------------------------------

Return Values

--- NONE ---

func (*ErrPrefixDto) SetEPrefOld

func (ePrefDto *ErrPrefixDto) SetEPrefOld(
	oldErrPrefix string)

SetEPrefOld - Deletes the current error prefix information and initializes this ErrPrefixDto instance with an old or preexisting error prefix string. This error prefix string input parameter typically includes one or more error prefix elements and may also include associated error context elements. This string will be parsed and into individual error prefix and error context components and stored internally in the current ErrPrefixDto instance.

Error prefix text is designed to be configured at the beginning of error messages and is most often used to document the thread of code execution by listing the calling sequence for a specific list of functions and methods.

The error context string is designed to provide additional information about the function or method identified by the associated error prefix string. Typical context information might include variable names, variable values and additional details on function execution.

IMPORTANT All existing error prefix and error context information in this ErrPrefixDto instance will be overwritten and deleted.

----------------------------------------------------------------

Input Parameters

oldErrPrefix        string
   - This includes the previous or preexisting error prefix
     string. This string will be parsed into error prefix
     and error context components and stored in the current
     ErrPrefixDto instance.

     This string should consist of a series of error prefix
     strings. Error prefixes should be delimited by either a
     new line character ('\n') or the in-line delimiter string,
     " - ".

     If this string contains associated error context strings
     as well, they should be delimited with either a new line
     delimiter string, "\n :  " or an in-line delimiter string,
     " : ".

-----------------------------------------------------------------

Return Values

--- NONE ---

func (*ErrPrefixDto) SetEPrefStrings added in v1.5.0

func (ePrefDto *ErrPrefixDto) SetEPrefStrings(
	twoDStrArray [][2]string)

SetEPrefStrings - This method first deletes all pre-existing error prefix and error context information and then replaces that information with new data extracted from the two-dimensional string array passed as an input parameter ('twoDStrArray').

This two-dimensional string array contains both error prefix and error context information. The Error Prefix string is always in the [x][0] position. The Error Context string is always in the [x][1] position. The Error Context string is optional and may be an empty string.

If input parameter 'twoDStrArray' is 'nil' or a zero length array, this method will take no action and exit.

To 'append' or 'add' a two-dimensional string array to existing error prefix information, see method:

ErrPrefixDto.AddEPrefStrings()

func (*ErrPrefixDto) SetIsLastLineTermWithNewLine

func (ePrefDto *ErrPrefixDto) SetIsLastLineTermWithNewLine(
	isLastLineTerminatedWithNewLine bool)

SetIsLastLineTermWithNewLine - By default, the last line of error prefix strings returned by the method ErrPrefixDto.String() ARE NOT terminated with a new line character ('\n'). In other words, by default, the last line of returned error prefix strings do not end with a new line character ('\n').

If the user prefers to terminate the last line of error prefix strings returned by this instance of ErrPrefixDto with a new line character ('\n'), the input parameter, 'isLastLineTerminatedWithNewLine', should be set to 'true'.

Error prefix strings are returned by calling method 'ErrPrefixDto.String()'.

----------------------------------------------------------------

Input Parameters

isLastLineTerminatedWithNewLine    bool
   - If this parameter is set to 'true', the last line of all
     error prefix strings returned by this ErrPrefixDto
     instance WILL BE terminated with a new line character
     ('\n').

-----------------------------------------------------------------

Return Values

--- NONE ---

func (*ErrPrefixDto) SetMaxTextLineLen added in v1.2.0

func (ePrefDto *ErrPrefixDto) SetMaxTextLineLen(
	maxErrPrefixTextLineLength int)

SetMaxTextLineLen - Sets the maximum limit on the number of characters allowed in an error prefix text line output for display purposes.

Setting this value will control the maximum character limit for this specific ErrPrefixDto instance. This maximum limit will remain in force for the life of this ErrPrefixDto instance or until another call is made to this method changing the value.

When this instance of ErrPrefixDto was initially created, a default value of 40-characters was applied.

----------------------------------------------------------------

Input Parameters

maxErrPrefixTextLineLength      int
   - This unsigned integer value will be used to set the
     maximum number of characters allowed in a text display
     line for error prefix information.

     If 'maxErrPrefixTextLineLength' is set to a value less
     than ten (10) or to a value greater than one-million
     (1,000,000), this method will take no action and exit.

-----------------------------------------------------------------

Return Values

--- NONE ---

func (*ErrPrefixDto) SetMaxTextLineLenToDefault added in v1.2.0

func (ePrefDto *ErrPrefixDto) SetMaxTextLineLenToDefault()

SetMaxTextLineLenToDefault - Maximum Error Prefix Line Length is the maximum limit on the number of characters allowed in a single error prefix text line.

This method resets that maximum limit to its default value of 40-characters.

func (*ErrPrefixDto) StrMaxLineLen added in v1.2.0

func (ePrefDto *ErrPrefixDto) StrMaxLineLen(
	maxLineLen int) string

StrMaxLineLen - Returns a formatted error prefix/context string incorporating all error prefix and error context information previously added to this ErrPrefixDto instance.

Input parameter 'maxLineLen' is used to set the maximum line length for text returned by this method. It does not alter the maximum line length default value for this ErrPrefixDto instance.

Error prefix information is stored internally in the 'ePrefCol' array.

func (ErrPrefixDto) String

func (ePrefDto ErrPrefixDto) String() string

String - Returns a formatted error prefix/context string incorporating all error prefixes previously added to this instance.

Error prefix information is stored internally in the 'ePrefCol' array.

func (*ErrPrefixDto) XCtx added in v1.1.0

func (ePrefDto *ErrPrefixDto) XCtx(
	newErrContext string) *ErrPrefixDto

XCtx - Sets or resets the error context for the last error prefix. This operation either adds, or replaces, the error context string associated with the last error prefix the current list of error prefixes maintained by this instance.

This method is identical in function to ErrPrefixDto.SetCtx(). The only difference is that this method returns a pointer to the current ErrPrefixDto instance.

If the last error prefix already has an error context string, it will be replaced by input parameter, 'newErrContext'.

If the last error prefix does NOT have an associated error context, this new error context string will be associated with that error prefix.

If the internal list of error prefixes is currently empty, this method will take no action and exit.

If the input parameter string 'newErrContext' is 'empty' (zero length string), this method will delete the last error context associated with the last error prefix in the error prefix collection.

----------------------------------------------------------------

Input Parameters

newErrContext       string
   - This string holds the new error context information. If
     the last error prefix in internal storage already has an
     associated error context, that context will be deleted and
     replaced by 'newErrContext'. If, however, the last error
     prefix does NOT have an associated error context, this
     'newErrContext' string will be added and associated with
     that last error prefix.

     If this string is 'empty' (zero length string), this
     method will delete the last error context associated with
     the last error prefix in the error prefix collection.

-----------------------------------------------------------------

Return Values

*ErrPrefixDto
   - Returns a pointer to the current ErrPrefixDto instance

func (*ErrPrefixDto) XCtxEmpty added in v1.3.0

func (ePrefDto *ErrPrefixDto) XCtxEmpty() *ErrPrefixDto

XCtxEmpty - Deletes the last error context for the last error prefix in this instance of ErrPrefixDto

----------------------------------------------------------------

Input Parameters

--- NONE ---

-----------------------------------------------------------------

Return Values

*ErrPrefixDto
   - Returns a pointer to the current ErrPrefixDto instance

func (*ErrPrefixDto) XEPref added in v1.1.0

func (ePrefDto *ErrPrefixDto) XEPref(
	newErrPrefix string) *ErrPrefixDto

XEPref - Adds an error prefix string to the list of previous error prefix strings maintained by this instance of ErrPrefixDto.

This method is identical in function to ErrPrefixDto.SetEPref(). The only difference is that this method returns a pointer to the current ErrPrefixDto instance.

The error prefix text is designed to be configured at the beginning of error messages and is most often used to document the thread of code execution by listing the calling sequence for specific functions and methods.

This method is designed to process a single error prefix string passed in input parameter 'ErrPrefixDto'. If this string contains multiple error prefixes, use method 'ErrPrefixDto.SetEPrefOld()'.

----------------------------------------------------------------

Input Parameters

newErrPrefix        string
   - The new error prefix represents typically identifies
     the function or method which is currently executing. This
     information is used to document source code execution flow
     in error messages.

     This new error prefix will be added to the internal list
     of error prefixes maintained by this ErrPrefixDto
     instance.

-----------------------------------------------------------------

Return Values

*ErrPrefixDto
   - Returns a pointer to the current ErrPrefixDto instance

func (*ErrPrefixDto) XEPrefCtx added in v1.1.0

func (ePrefDto *ErrPrefixDto) XEPrefCtx(
	newErrPrefix string,
	newErrContext string) *ErrPrefixDto

XEPrefCtx - Adds an error prefix and an error context string to the list of previous error prefix/context information.

This method is identical in function to ErrPrefixDto.SetEPrefCtx(). The only difference is that this method returns a pointer to the current ErrPrefixDto instance.

Error prefix text is designed to be configured at the beginning of error messages and is most often used to document the thread of code execution by listing the calling sequence for a specific list of functions and methods.

The error context string is designed to provide additional information about the function or method identified by the associated error prefix string. Typical context information might include variable names, variable values and additional details on function execution.

----------------------------------------------------------------

Input Parameters

newErrPrefix        string
   - The new error prefix represents typically identifies
     the function or method which is currently executing. This
     information is used to document source code execution flow
     in error messages.

     This method is designed to process a single new error prefix
     string. To process a collection of error prefix strings, see
     method 'ErrPrefixDto.SetEPrefOld()'.

newErrContext       string
   - This is the error context information associated with the
     new error prefix ('newErrPrefix'). This parameter is
     optional and will accept an empty string.

-----------------------------------------------------------------

Return Values

*ErrPrefixDto
   - Returns a pointer to the current ErrPrefixDto instance

func (*ErrPrefixDto) XEPrefOld added in v1.1.0

func (ePrefDto *ErrPrefixDto) XEPrefOld(
	oldErrPrefix string) *ErrPrefixDto

XEPrefOld - Deletes the current error prefix information and initializes this ErrPrefixDto instance with an old or preexisting error prefix string. This error prefix string input parameter typically includes one or more error prefix elements and may also include associated error context elements. This string will be parsed and into individual error prefix and error context components and stored internally in the current ErrPrefixDto instance.

This method is identical in function to ErrPrefixDto.SetEPrefOld(). The only difference is that this method returns a pointer to the current ErrPrefixDto instance.

Error prefix text is designed to be configured at the beginning of error messages and is most often used to document the thread of code execution by listing the calling sequence for a specific list of functions and methods.

The error context string is designed to provide additional information about the function or method identified by the associated error prefix string. Typical context information might include variable names, variable values and additional details on function execution.

IMPORTANT All existing error prefix and error context information in this ErrPrefixDto instance will be overwritten and deleted.

----------------------------------------------------------------

Input Parameters

oldErrPrefix        string
   - This includes the previous or preexisting error prefix
     string. This string will be parsed into error prefix
     and error context components and stored in the current
     ErrPrefixDto instance.

     This string should consist of a series of error prefix
     strings. Error prefixes should be delimited by either a
     new line character ('\n') or the in-line delimiter string,
     " - ".

     If this string contains associated error context strings
     as well, they should be delimited with either a new line
     delimiter string, "\n :  " or an in-line delimiter string,
     " : ".

-----------------------------------------------------------------

Return Values

*ErrPrefixDto
   - Returns a pointer to the current ErrPrefixDto instance

func (*ErrPrefixDto) ZCtx added in v1.4.0

func (ePrefDto *ErrPrefixDto) ZCtx(
	newErrContext string) ErrPrefixDto

ZCtx - Sets or resets the error context for the last error prefix. This operation either adds, or replaces, the error context string associated with the last error prefix the current list of error prefixes maintained by this instance.

This method is identical in function to ErrPrefixDto.SetCtx(). The only difference is that this method returns a deep copy of the current ErrPrefixDto instance.

If the last error prefix already has an error context string, it will be replaced by input parameter, 'newErrContext'.

If the last error prefix does NOT have an associated error context, this new error context string will be associated with that error prefix.

If the internal list of error prefixes is currently empty, this method will take no action and exit.

If the input parameter string 'newErrContext' is 'empty' (zero length string), this method will delete the last error context associated with the last error prefix in the error prefix collection.

This method returns a deep copy of the current ErrPrefixDto instance after it is updated with new error context information. This copy of ErrPrefixDto returned by value.

----------------------------------------------------------------

Input Parameters

newErrContext       string
   - This string holds the new error context information. If
     the last error prefix in internal storage already has an
     associated error context, that context will be deleted and
     replaced by 'newErrContext'. If, however, the last error
     prefix does NOT have an associated error context, this
     'newErrContext' string will be added and associated with
     that last error prefix.

     If this string is 'empty' (zero length string), this
     method will delete the last error context associated with
     the last error prefix in the error prefix collection.

-----------------------------------------------------------------

Return Values

ErrPrefixDto
   - This method returns a deep copy of the current
     ErrPrefixDto instance after it is updated with new error
     context information. This copy is returned by value.

func (*ErrPrefixDto) ZCtxEmpty added in v1.4.0

func (ePrefDto *ErrPrefixDto) ZCtxEmpty() ErrPrefixDto

ZCtxEmpty - Deletes the last error context for the last error prefix in this instance of ErrPrefixDto.

This method returns a deep copy of the current ErrPrefixDto instance after it is updated with the deletion of the last error context. This copy is returned by value.

----------------------------------------------------------------

Input Parameters

--- NONE ---

-----------------------------------------------------------------

Return Values

ErrPrefixDto
   - This method returns a deep copy of the current
     ErrPrefixDto instance after it is updated with the
     deletion of the last error context. This copy is returned
     by value.

func (*ErrPrefixDto) ZEPref added in v1.4.0

func (ePrefDto *ErrPrefixDto) ZEPref(
	newErrPrefix string) ErrPrefixDto

ZEPref - Adds an error prefix string to the list of previous error prefix strings maintained by this instance of ErrPrefixDto.

This method is identical in function to ErrPrefixDto.SetEPref(). The only difference is that this method returns an ErrPrefixDto instance by value.

The error prefix text is designed to be configured at the beginning of error messages and is most often used to document the thread of code execution by listing the calling sequence for specific functions and methods.

This method is designed to process a single error prefix string passed in input parameter 'ErrPrefixDto'. If this string contains multiple error prefixes, use method 'ErrPrefixDto.SetEPrefOld()'.

This method returns a deep copy of the current ErrPrefixDto instance after it is updated with new error prefix information. This copy of ErrPrefixDto is returned by value.

----------------------------------------------------------------

Input Parameters

newErrPrefix        string
   - The new error prefix represents typically identifies
     the function or method which is currently executing. This
     information is used to document source code execution flow
     in error messages.

     This new error prefix will be added to the internal list
     of error prefixes maintained by this ErrPrefixDto
     instance.

-----------------------------------------------------------------

Return Values

ErrPrefixDto
   - This method returns a deep copy of the current
     ErrPrefixDto instance after it is updated with
     new error prefix information. This copy of
     ErrPrefixDto is returned by value.

func (*ErrPrefixDto) ZEPrefCtx added in v1.4.0

func (ePrefDto *ErrPrefixDto) ZEPrefCtx(
	newErrPrefix string,
	newErrContext string) ErrPrefixDto

ZEPrefCtx - Adds an error prefix and an error context string to the list of previous error prefix/context information.

This method is identical in function to ErrPrefixDto.SetEPrefCtx(). The only difference is that this method returns an ErrPrefixDto instance by value.

Error prefix text is designed to be configured at the beginning of error messages and is most often used to document the thread of code execution by listing the calling sequence for a specific list of functions and methods.

The error context string is designed to provide additional information about the function or method identified by the associated error prefix string. Typical context information might include variable names, variable values and additional details on function execution.

This method returns a deep copy of the current ErrPrefixDto instance after it is updated with new error prefix and error context information. This copy of ErrPrefixDto is returned by value.

----------------------------------------------------------------

Input Parameters

newErrPrefix        string
   - The new error prefix represents typically identifies
     the function or method which is currently executing. This
     information is used to document source code execution flow
     in error messages.

     This method is designed to process a single new error prefix
     string. To process a collection of error prefix strings, see
     method 'ErrPrefixDto.SetEPrefOld()'.

newErrContext       string
   - This is the error context information associated with the
     new error prefix ('newErrPrefix'). This parameter is
     optional and will accept an empty string.

-----------------------------------------------------------------

Return Values

ErrPrefixDto
   - This method returns a deep copy of the current
     ErrPrefixDto instance after it is updated with new error
     prefix and error context information. This copy of
     ErrPrefixDto is returned by value.

func (*ErrPrefixDto) ZEPrefOld added in v1.4.0

func (ePrefDto *ErrPrefixDto) ZEPrefOld(
	oldErrPrefix string) ErrPrefixDto

ZEPrefOld - Deletes the current error prefix information and initializes this ErrPrefixDto instance with an old or preexisting error prefix string. This error prefix string input parameter typically includes one or more error prefix elements and may also include associated error context elements. This string will be parsed and into individual error prefix and error context components and stored internally in the current ErrPrefixDto instance.

This method is identical in function to ErrPrefixDto.SetEPrefOld(). The only difference is that this method returns an ErrPrefixDto instance by value.

Error prefix text is designed to be configured at the beginning of error messages and is most often used to document the thread of code execution by listing the calling sequence for a specific list of functions and methods.

The error context string is designed to provide additional information about the function or method identified by the associated error prefix string. Typical context information might include variable names, variable values and additional details on function execution.

This method returns a deep copy of the current ErrPrefixDto instance after it is updated with preexisting error prefix information. This copy of ErrPrefixDto is returned by value.

IMPORTANT All existing error prefix and error context information in this ErrPrefixDto instance will be overwritten and deleted.

----------------------------------------------------------------

Input Parameters

oldErrPrefix        string
   - This includes the previous or preexisting error prefix
     string. This string will be parsed into error prefix
     and error context components and stored in the current
     ErrPrefixDto instance.

     This string should consist of a series of error prefix
     strings. Error prefixes should be delimited by either a
     new line character ('\n') or the in-line delimiter string,
     " - ".

     If this string contains associated error context strings
     as well, they should be delimited with either a new line
     delimiter string, "\n :  " or an in-line delimiter string,
     " : ".

-----------------------------------------------------------------

Return Values

ErrPrefixDto
   - This method returns a deep copy of the current
     ErrPrefixDto instance after it is updated with preexisting
     error prefix information. This copy of ErrPrefixDto is
     returned by value.

type ErrorPrefixInfo

type ErrorPrefixInfo struct {
	// contains filtered or unexported fields
}

func (*ErrorPrefixInfo) CopyIn

func (errorPrefixInfo *ErrorPrefixInfo) CopyIn(
	inComingErrPrefixInfo *ErrorPrefixInfo,
	ePrefix string) error

CopyIn - Copies the data fields from an incoming instance of ErrorPrefixInfo ('inComingErrPrefixInfo') to the data fields of the current ErrorPrefixInfo instance ('errorPrefixInfo').

If 'inComingErrPrefixInfo' is judged to be invalid, this method will return an error.

All of the data fields in current ErrorPrefixInfo instance ('errorPrefixInfo') will be modified and overwritten.

----------------------------------------------------------------

Input Parameters

inComingErrPrefixInfo      *ErrorPrefixInfo
   - A pointer to an instance of ErrorPrefixInfo. This method
     will NOT change the values of internal member variables
     contained in this instance.

     All data values in this ErrorPrefixInfo instance will be
     copied to current ErrorPrefixInfo instance
     ('errorPrefixInfo').

     If this ErrorPrefixInfo instance proves to be invalid, an
     error will be returned.

ePrefix                    string
   - This is an error prefix which is included in all returned
     error messages. Usually, it contains the names of the calling
     method or methods. Note: Be sure to leave a space at the end
     of 'ePrefix'.

------------------------------------------------------------------------

Return Values

err                        error
   - If this method completes successfully, the returned error Type
     is set to 'nil'. If errors are encountered during processing,
     the returned error Type will encapsulate an error message.
     Note that this error message will incorporate the method
     chain and text passed by input parameter, 'ePrefix'.

func (*ErrorPrefixInfo) CopyOut

func (errorPrefixInfo *ErrorPrefixInfo) CopyOut(
	ePrefix string) (
	ErrorPrefixInfo,
	error)

CopyOut - Creates a deep copy of the data fields contained in the current ErrorPrefixInfo instance, and returns that data as a new instance of ErrorPrefixInfo.

------------------------------------------------------------------------

Input Parameters

ePrefix             string
   - This is an error prefix which is included in all returned
     error messages. Usually, it contains the names of the calling
     method or methods. Note: Be sure to leave a space at the end
     of 'ePrefix'.

------------------------------------------------------------------------

Return Values

ErrorPrefixInfo
   - If this method completes successfully, a deep copy of the
     current ErrorPrefixInfo instance will be returned through
     this parameter as a completely new instance of
     ErrorPrefixInfo.

error
   - If this method completes successfully, the returned error Type
     is set to 'nil'. If errors are encountered during processing,
     the returned error Type will encapsulate an error message.
     Note that this error message will incorporate the method
     chain and text passed by input parameter, 'ePrefix'. The
     'ePrefix' text will be prefixed to the beginning of the returned
     error message.

func (*ErrorPrefixInfo) Empty added in v1.5.0

func (errorPrefixInfo *ErrorPrefixInfo) Empty()

Empty - Resets all internal member variables to their zero values.

func (*ErrorPrefixInfo) Equal

func (errorPrefixInfo *ErrorPrefixInfo) Equal(
	ePrefixInfo02 *ErrorPrefixInfo) bool

Equal - Returns a boolean flag signaling whether the data values contained in the current ErrorPrefixInfo instance are equal to to those contained in input parameter, 'ePrefixInfo02'

------------------------------------------------------------------------

Input Parameters

ePrefixInfo02       *ErrorPrefixInfo
   - A pointer to an instance of ErrorPrefixInfo. The data
     values contained in this instance will be compared to
     those contained in the current ErrorPrefixInfo instance
     (errorPrefixInfo) to determine equality.

------------------------------------------------------------------------

Return Values

bool
   - A boolean flag signaling whether the data values contained
     in the current ErrorPrefixInfo instance are equal to those
     contained in input parameter 'ePrefixInfo02'. If the data
     values are equal in all respects, this returned boolean
     value will be set to 'true'.

func (*ErrorPrefixInfo) GetErrContextStr

func (errorPrefixInfo *ErrorPrefixInfo) GetErrContextStr() string

GetErrContextStr - Returns the Error Context String.

func (*ErrorPrefixInfo) GetErrPrefixHasContextStr

func (errorPrefixInfo *ErrorPrefixInfo) GetErrPrefixHasContextStr() bool

GetErrPrefixHasContextStr - Returns a boolean flag signaling whether the Error Prefix String defined in this ErrorPrefixInfo instance has an associated Error Context string.

If the returned boolean value is 'true' is signals that this Error Prefix has an associated Error Context String.

func (*ErrorPrefixInfo) GetErrPrefixStr

func (errorPrefixInfo *ErrorPrefixInfo) GetErrPrefixStr() string

GetErrPrefixStr - Returns the Error Prefix String.

func (*ErrorPrefixInfo) GetIsFirstIndex

func (errorPrefixInfo *ErrorPrefixInfo) GetIsFirstIndex() bool

GetIsFirstIndex - Returns a boolean flag signaling whether the current ErrorPrefixInfo instance is the First element in an array.

If the returned boolean value is 'true', it signals that this ErrorPrefixInfo object is the First element in an array.

func (*ErrorPrefixInfo) GetIsLastIndex

func (errorPrefixInfo *ErrorPrefixInfo) GetIsLastIndex() bool

GetIsLastIndex - Returns a boolean flag signaling whether the current ErrorPrefixInfo instance is the last element in an array.

If the returned boolean value is 'true', it signals that this ErrorPrefixInfo object is the last element in an array.

func (*ErrorPrefixInfo) GetIsPopulated

func (errorPrefixInfo *ErrorPrefixInfo) GetIsPopulated() bool

GetIsPopulated - Returns a boolean flag signaling whether the current ErrorPrefixInfo instance is populated with valid data.

If the returned boolean value is 'true', it signals that this ErrorPrefixInfo object IS POPULATED with valid data.

func (*ErrorPrefixInfo) GetLengthErrContextStr

func (errorPrefixInfo *ErrorPrefixInfo) GetLengthErrContextStr() uint

GetLengthErrContextStr - Returns the number of characters in the Error Context String. This is also known as the string length and it is returned as a type unsigned integer.

func (*ErrorPrefixInfo) GetLengthErrPrefixStr

func (errorPrefixInfo *ErrorPrefixInfo) GetLengthErrPrefixStr() uint

GetLengthErrPrefixStr - Returns the number of characters in the Error Prefix String. This also known as the string length and it is returned as a type unsigned integer.

func (*ErrorPrefixInfo) IsValidInstance

func (errorPrefixInfo *ErrorPrefixInfo) IsValidInstance() (
	isValid bool)

IsValidInstance - Returns a boolean flag signaling whether the current ErrorPrefixInfo instance is invalid.

If the returned boolean value is 'true', it signals that the current ErrorPrefixInfo instance is valid and populated with data.

If the boolean value is 'false', it signals that the current ErrorPrefixInfo instance is invalid.

----------------------------------------------------------------

Input Parameters

--- NONE ---

-----------------------------------------------------------------

Return Values

isValid             bool
   - If the current ErrorPrefixInfo instance, 'errorPrefixInfo',
     contains invalid data, this boolean value is set to 'false'.

     If the current ErrorPrefixInfo instance, 'errorPrefixInfo',
     is valid, this boolean value is set to 'true'.

func (*ErrorPrefixInfo) IsValidInstanceError

func (errorPrefixInfo *ErrorPrefixInfo) IsValidInstanceError(
	ePrefix string) error

IsValidInstanceError - Returns an error object signaling whether the current ErrorPrefixInfo instance is invalid.

If the returned error value is 'nil', it signals that the current ErrorPrefixInfo instance is valid and populated with data.

If the returned error value is NOT 'nil', it signals that the current ErrorPrefixInfo is invalid. In this case, the error object will contain an appropriate error message.

----------------------------------------------------------------

Input Parameters

ePrefix             string
   - This is an error prefix which is included in all returned
     error messages. Usually, it contains the names of the calling
     method or methods. Be sure to leave a space at the end of
     'ePrefix'.

-----------------------------------------------------------------

Return Values

error
   - If the current ErrorPrefixInfo instance, 'errorPrefixInfo',
     contains invalid data, a detailed error message will be
     returned identifying the invalid data item.

     If the current ErrorPrefixInfo instance, 'errorPrefixInfo',
     is valid, this error parameter will be set to 'nil'.

func (ErrorPrefixInfo) New

func (errorPrefixInfo ErrorPrefixInfo) New() ErrorPrefixInfo

New - Creates and returns a new instance of type, 'ErrorPrefixInfo'.

func (ErrorPrefixInfo) Ptr

func (errorPrefixInfo ErrorPrefixInfo) Ptr() *ErrorPrefixInfo

Ptr - Returns a pointer to a new instance of ErrorPrefixInfo.

func (*ErrorPrefixInfo) SetErrContextStr

func (errorPrefixInfo *ErrorPrefixInfo) SetErrContextStr(
	errContext string)

SetErrContextStr - Sets the Error Context String value.

In addition, this method also calculates and set the value of length or number of characters contained in the Error Context String.

func (*ErrorPrefixInfo) SetErrPrefixHasContext

func (errorPrefixInfo *ErrorPrefixInfo) SetErrPrefixHasContext(
	errPrefixHasContextStr bool)

SetErrPrefixHasContext - Sets an internal boolean flag specifying whether the Error Prefix String for this ErrorPrefixInfo instance has an associated Error Context String.

If this boolean flag is set to 'true' is signals that this Error Prefix String has an associated Error Context String.

func (*ErrorPrefixInfo) SetErrPrefixStr

func (errorPrefixInfo *ErrorPrefixInfo) SetErrPrefixStr(
	errPrefix string)

SetErrPrefixStr - Sets the value of the error prefix string.

In addition, this method also calculates and set the value of length or number of characters contained in the error prefix string.

func (*ErrorPrefixInfo) SetIsFirstIndex

func (errorPrefixInfo *ErrorPrefixInfo) SetIsFirstIndex(isFirstIndex bool)

SetIsFirstIndex - Sets an internal flag designating whether the current ErrorPrefixInfo instance is the first element in an array of ErrorPrefixInfo objects.

If the input parameter 'isFirstIndex' is 'true', it signals that this ErrorPrefixInfo object is the FIRST element in an array.

func (*ErrorPrefixInfo) SetIsLastIndex

func (errorPrefixInfo *ErrorPrefixInfo) SetIsLastIndex(isLastIdx bool)

SetIsLastIndex - Sets an internal flag designating whether the current ErrorPrefixInfo instance is the last element in an array of ErrorPrefixInfo objects.

If the input parameter 'isLastIdx' is 'true', it signals that this ErrorPrefixInfo object is the LAST element in an array.

func (*ErrorPrefixInfo) SetIsPopulated

func (errorPrefixInfo *ErrorPrefixInfo) SetIsPopulated(
	isPopulated bool)

SetIsPopulated - Sets an internal flag indicating whether the current ErrorPrefixInfo instance is, or is NOT, populated with valid data.

If input parameter 'isPopulated' is set to 'true' it signals this instance of ErrorPrefixInfo is populated with valid data.

type IBasicErrorPrefix added in v1.5.0

type IBasicErrorPrefix interface {
	GetEPrefStrings() [][2]string
}

type IBuilderErrorPrefix added in v1.5.0

type IBuilderErrorPrefix interface {
	GetEPrefStrings() [][2]string

	SetEPrefStrings(twoDStrArray [][2]string)

	String() string
}

type IErrorPrefix added in v1.3.0

type IErrorPrefix interface {
	GetEPrefStrings() [][2]string

	GetEPrefCollectionLen() int

	GetIsLastLineTerminatedWithNewLine() bool

	SetCtx(newErrContext string)

	SetCtxEmpty()

	SetEPref(newErrPrefix string)

	SetEPrefCtx(newErrPrefix string, newErrContext string)

	SetEPrefOld(oldErrPrefix string)

	SetEPrefStrings(twoDStrArray [][2]string)

	SetMaxTextLineLen(maxErrPrefixTextLineLength int)

	SetIsLastLineTermWithNewLine(isLastLineTerminatedWithNewLine bool)

	String() string
}

Jump to

Keyboard shortcuts

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