This commit is contained in:
lbenedar
2026-04-02 18:37:30 +03:00
commit d5577f10d7
26 changed files with 1946 additions and 0 deletions

View 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 }