32 lines
892 B
Go
32 lines
892 B
Go
package foundry
|
|
|
|
import (
|
|
"errors"
|
|
"fmt"
|
|
)
|
|
|
|
var (
|
|
ErrorFoundryNotInit = errors.New("Foundry is not initialized")
|
|
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 TransportCode
|
|
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 }
|