blob: 0eb747ed29c37714ef5412a4975f5a27f53c034e [file] [log] [blame]
// Copyright 2020 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.
use crate::events::error::EventError;
use thiserror::Error;
use super::listener::ListenerError;
use diagnostics_message::error::MessageError;
#[derive(Debug, Error)]
pub enum LogsError {
#[error("couldn't connect to {protocol}: {source}")]
ConnectingToService { protocol: &'static str, source: anyhow::Error },
#[error("couldn't retrieve the ReadOnlyLog debuglog handle: {source}")]
RetrievingDebugLog { source: fidl::Error },
#[error("malformed event: `{source}`")]
MalformedEvent {
source: EventError,
#[error("error while handling {protocol} requests: {source}")]
HandlingRequests { protocol: &'static str, source: fidl::Error },
#[error("error from a listener: {source}")]
Listener {
source: ListenerError,
#[derive(Debug, Error)]
pub enum StreamError {
#[error("couldn't read from socket: {source:?}")]
Io {
source: std::io::Error,
#[error("socket was closed and no messages remain")]
Message(#[from] MessageError),
#[error("couldn't convert debuglog message")]
impl PartialEq for StreamError {
fn eq(&self, other: &Self) -> bool {
use StreamError::*;
match (self, other) {
(Io { source }, Io { source: s2 }) => source.kind() == s2.kind(),
(Message(source), Message(s2)) => source == s2,
_ => false,