init
This commit is contained in:
32
internal/foundry/errors.go
Normal file
32
internal/foundry/errors.go
Normal file
@@ -0,0 +1,32 @@
|
||||
package foundry
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
var (
|
||||
ErrorSidWrongFormat = errors.New("Session id wrong format")
|
||||
ErrorSidNotFound = errors.New("Session id didn't find in response header")
|
||||
ErrorAuthPassWrong = errors.New("Authentication password is wrong")
|
||||
ErrorNotAuth = errors.New("Admin is not authenticated")
|
||||
ErrorIsNotReady = errors.New("Connection is not ready for communication")
|
||||
|
||||
ErrorMsgNotHaveNumber = errors.New("Message doesn't have dataCode and id")
|
||||
ErrorTimeout = errors.New("Answer has not been received after timeout")
|
||||
ErrorReadChannel = errors.New("Error when reading from msg channel")
|
||||
|
||||
ListenIsDone = errors.New("Listen for websocket data in foundry is stopped")
|
||||
)
|
||||
|
||||
type FoundryError struct {
|
||||
Err error
|
||||
Type FoundryCode
|
||||
IsFatal bool
|
||||
}
|
||||
|
||||
func (e *FoundryError) Error() string {
|
||||
return fmt.Sprintf("Received from %d: %s", e.Type, e.Err.Error())
|
||||
}
|
||||
|
||||
func (e *FoundryError) Unwrap() error { return e.Err }
|
||||
Reference in New Issue
Block a user