blob: 9e9c4c2bfcfb0b3a69376287791710f02801bf50 [file] [log] [blame]
// Copyright 2018 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//! Custom error types for the netstack.
use failure::Fail;
/// Top-level error type the netstack.
#[derive(Fail, Debug)]
pub enum NetstackError {
#[fail(display = "{}", _0)]
/// Errors related to packet parsing.
Parse(#[cause] ParseError),
// Add error types here as we add more to the stack
}
/// Error type for packet parsing.
#[derive(Fail, Debug, PartialEq)]
#[allow(missing_docs)]
pub enum ParseError {
#[fail(display = "Operation is not supported")]
NotSupported,
#[fail(display = "Operation was not expected in this context")]
NotExpected,
#[fail(display = "Invalid checksum")]
Checksum,
#[fail(display = "Packet is not formatted properly")]
Format,
}