1// Copyright 2021 The Fuchsia Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
45use thiserror::Error;
67use crate::frame::FrameParseError;
8use crate::{Role, DLCI};
910/// Errors that occur during the usage of the RFCOMM library.
11#[derive(Error, Debug)]
12pub enum Error {
13#[error("Error parsing frame: {:?}", .0)]
14Frame(FrameParseError),
15#[error("Invalid DLCI: {:?}", .0)]
16InvalidDLCI(DLCI),
17#[error("Invalid role: {:?}", .0)]
18InvalidRole(Role),
19#[error(transparent)]
20Other(#[from] anyhow::Error),
21}
2223impl From<FrameParseError> for Error {
24fn from(src: FrameParseError) -> Self {
25Self::Frame(src)
26 }
27}