Documentation ¶
Index ¶
Constants ¶
View Source
const ( // DefaultCodeSpace defines the default code space for not predefined error. DefaultCodeSpace = "GfSp" // DefaultInnerCode defines the default inner code for not predefined error. DefaultInnerCode = 999999 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GfSpErrorManager ¶
type GfSpErrorManager struct {
// contains filtered or unexported fields
}
GfSpErrorManager manages the predefined GfSpError, the GfSpError uses as the standard error format inside the SP system, it includes the CodeSpace, HttpStatusCode, InnerCode and Description fields. The HttpStatusCode uses to fill the http response header, the InnerCode and Description uses to fill the http response body if the request is failed, the CodeSpace and InnerCode uses to help developer tp quickly pinpoint the cause and location of errors.
The InnerCode detailed specifications can be found at:
"github.com/bnb-chain/greenfield-storage-provider/base/errors.md"
func (*GfSpErrorManager) AddErr ¶
func (g *GfSpErrorManager) AddErr(err *GfSpError)
AddErr add an error to the manager, predefined errors need to ensure the uniqueness of inner error codes.
Click to show internal directories.
Click to hide internal directories.