Files
Foundry-Scrapping-API/internal/foundry/errors.go
2026-04-07 18:47:35 +03:00

33 lines
962 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")
ErrorStateTypeNotExist = errors.New("State type does not exists")
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 }