use chunk_io::{ChunkDeserializationError, ChunkSerializationError};
use messages::{MessageDeserializationError, MessageSerializationError};
use thiserror::Error;
#[derive(Debug, Error)]
pub enum ServerSessionError {
#[error("An error occurred deserializing incoming data: {0}")]
ChunkDeserializationError(#[from] ChunkDeserializationError),
#[error("An error occurred serializing outbound messages: {0}")]
ChunkSerializationError(#[from] ChunkSerializationError),
#[error(
"An error occurred while attempting to turn an RTMP message into a message payload: {0}"
)]
MessageSerializationError(#[from] MessageSerializationError),
#[error(
"An error occurred while attempting to turn a message payload into an RTMP message: {0}"
)]
MessageDeserializationError(#[from] MessageDeserializationError),
#[error(
"Attempted to accept or reject request id {0} but no outstanding requests have that id"
)]
InvalidOutstandingRequest(u32),
#[error("The connection request did not have a non-empty RTMP app name")]
NoAppNameForConnectionRequest,
#[error("The request id specified could not be matched to an outstanding request")]
InvalidRequestId,
#[error("The '{action}' action was attempted on non-existant stream id {stream_id}")]
ActionAttemptedOnInactiveStream { action: String, stream_id: u32 },
}