modulepackage
1.1.2
Repository: https://github.com/kamontat/go-error-manager.git
Documentation: pkg.go.dev
# README
Error manager

Error manager for gitgo
and ndd-cli
(go edition)
Inspiration
The bad error handle in golang and cut off exception.
Usage 
The principle of the code is always continue and chainable. Most of the function are return itself for use other function in chain.
ErrManager
- The Error manager (
ErrManager
) is for management error and exception in golang. you can use it via 2.StartNewManageError()
return absolute new object - After that, several method that can chain
3.
SetError()
tell error manager that have error inside (auto called) 4.ReplaceNewError(error)
delete all error collection and add new one 5.AddNewError(error)
append error to collection 6.AddNewErrorMessage(string)
append error message to collection - To summary or get the result, you can use
HaveError()
check is error insideCountError()
get length of error collectionReset()
reset everything inside error managerThrow()
returnThrowable
for summary errors with default messageThrowWithMessage(func)
returnThrowable
; by default the message will generate be default message generator, this method allow you to customize it
Throwable
- Throwable also have several function for you
CanBeThrow()
it checker this object can throw (mean error occurred)GetMessage()
return the format messageShowMessage()
show message toStdout
ListErrors()
get the list of errors that save in Error managerExit()
will callos.Exit(1)
if this can be throwExitWithCode(int)
customize the code and callExit()
ResultManager
- The result manager is result management with executable functions
# Packages
No description provided by the author
# Functions
NewE will return new default ErrManager.
NewR will create new Result manager, you can use StartResultManager instead.
StartErrorManager will return new default ErrManager.
StartResultManager will create new Result manager.
Wrap is helper function to create ResultWrapper.
WrapNil will call result wrapper with nil value.
# Structs
ErrManager is for manage error in golang.
ResultManager is the wrap of result as string and error manager.
ResultWrapper is the concept of optional in other language.
Throwable is object for throw or output error message.
# Type aliases
MessageGenerator is function for generate error message.