Files @ 031c9d14adaa
Branch filter:

Location: CSY/reowolf/src/runtime/error.rs - annotation

031c9d14adaa 1.8 KiB application/rls-services+xml Show Source Show as Raw Download as Raw
MH
Merge branch 'feat-bytecode'

Adds size/alignment/offset computations to the type system and detects
potentially infinite types. If the type is potentially infinite but
contains a union that can break that type loop, then all other variants
of that union are supposed to be allocated on the heap. If the type
is potentially infinite but cannot be broken up, then we throw the
appropriate error.

The size/alignment/offset computations are not yet employed in the
runtime. But prepares Reowolf for a proper bytecode/IR implementation.
use crate::common::*;

#[derive(Debug)]
pub enum ConnectError {
    BindFailed(SocketAddr),
    UdpConnectFailed(SocketAddr),
    TcpInvalidConnect(SocketAddr),
    PollInitFailed,
    Timeout,
    PollFailed,
    AcceptFailed(SocketAddr),
    AlreadyConnected,
    PortPeerPolarityMismatch(PortId),
    NetEndpointSetupError(SocketAddr, NetEndpointError),
    SetupAlgMisbehavior,
}
#[derive(Eq, PartialEq, Copy, Clone, Debug)]
pub enum AddComponentError {
    DuplicatePort(PortId),
    NoSuchModule,
    NoSuchComponent,
    NonPortTypeParameters,
    CannotMovePort(PortId),
    WrongNumberOfParamaters { expected: usize },
    UnknownPort(PortId),
    WrongPortPolarity { port: PortId, expected_polarity: Polarity },
    DuplicateMovedPort(PortId),
}
////////////////////////
#[derive(Debug, Clone)]
pub enum UnrecoverableSyncError {
    PollFailed,
    BrokenNetEndpoint { index: usize },
    BrokenUdpEndpoint { index: usize },
    MalformedStateError(MalformedStateError),
}
#[derive(Debug, Clone)]
pub enum SyncError {
    NotConnected,
    InconsistentProtoComponent(ComponentId),
    RoundFailure,
    Unrecoverable(UnrecoverableSyncError),
}
#[derive(Debug, Clone)]
pub enum MalformedStateError {
    PortCannotPut(PortId),
    GetterUnknownFor { putter: PortId },
}
#[derive(Debug, Clone)]
pub enum NetEndpointError {
    MalformedMessage,
    BrokenNetEndpoint,
}
#[derive(Debug)]
pub enum PortOpError {
    WrongPolarity,
    UnknownPolarity,
    NotConnected,
    MultipleOpsOnPort,
    PortUnavailable,
}
#[derive(Debug, Eq, PartialEq)]
pub enum GottenError {
    NoPreviousRound,
    PortDidntGet,
    PreviousSyncFailed,
}
#[derive(Debug, Eq, PartialEq)]
pub struct WrongStateError;
/////////////////////
impl From<UnrecoverableSyncError> for SyncError {
    fn from(e: UnrecoverableSyncError) -> Self {
        Self::Unrecoverable(e)
    }
}