Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide more information reguarding reader issues #108

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/modules/exobiology/models/spawn_source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pub struct SpawnSource<'a> {
pub target_planet: &'a TargetPlanet,
}

impl<'a> SpawnSource<'a> {
impl SpawnSource<'_> {
/// Returns a list of species that could spawn on this spawn source.
pub fn get_spawnable_species(&self) -> Vec<Species> {
Species::iter()
Expand Down
2 changes: 1 addition & 1 deletion src/modules/journal/functions/auto_detect_journal_path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ pub fn auto_detect_journal_path() -> Option<PathBuf> {
return None;
}

return Some(expected_path);
Some(expected_path)
}

#[cfg(target_family = "unix")]
Expand Down
2 changes: 1 addition & 1 deletion src/modules/journal/shared/journal_buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::collections::VecDeque;
use std::path::PathBuf;
use std::sync::{Arc, Mutex};

use notify::event::{CreateKind, DataChange, ModifyKind};
use notify::event::{CreateKind, ModifyKind};
use notify::{Event, EventKind};
use thiserror::Error;

Expand Down
22 changes: 13 additions & 9 deletions src/modules/logs/log_file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@ use std::io;
use std::num::ParseIntError;
use std::path::PathBuf;

use chrono::NaiveDateTime;
use lazy_static::lazy_static;
use regex::Regex;
use thiserror::Error;

#[cfg(feature = "asynchronous")]
#[cfg_attr(docsrs, doc(cfg(feature = "asynchronous")))]
use super::asynchronous;
use super::blocking;
use crate::logs::asynchronous::LogFileReaderError as AsyncLogFileReaderError;
use crate::logs::blocking::LogFileReaderError as BlockingLogFileReaderError;
use chrono::NaiveDateTime;
use lazy_static::lazy_static;
use regex::Regex;
use thiserror::Error;

/// A representation of a journal log file. Can then be read using a [JournalFileReader].
#[derive(Debug)]
Expand All @@ -30,8 +31,11 @@ pub enum LogFileError {
#[error("Incorrect file name")]
IncorrectFileName,

#[error("Failed to open reader")]
FailedToOpenReader,
#[error("Failed to open reader: {0}")]
FailedToOpenBlockingReader(#[from] BlockingLogFileReaderError),

#[error("Failed to open reader: {0}")]
FailedToOpenAsyncReader(#[from] AsyncLogFileReaderError),

#[error("Failed to parse journal date time: {0}")]
FailedToParseDateTime(#[from] chrono::ParseError),
Expand Down Expand Up @@ -71,7 +75,7 @@ impl LogFile {
/// Creates a new reader using the path of the journal log file.
pub fn create_blocking_reader(&self) -> Result<blocking::LogFileReader, LogFileError> {
blocking::LogFileReader::open(self.path.as_path())
.map_err(|_| LogFileError::FailedToOpenReader)
.map_err(LogFileError::FailedToOpenBlockingReader)
}

/// Creates a new live reader using the path of the journal log file.
Expand All @@ -86,7 +90,7 @@ impl LogFile {
pub async fn create_async_reader(&self) -> Result<asynchronous::LogFileReader, LogFileError> {
asynchronous::LogFileReader::open(self.path.as_path())
.await
.map_err(|_| LogFileError::FailedToOpenReader)
.map_err(LogFileError::FailedToOpenAsyncReader)
}

#[cfg(feature = "asynchronous")]
Expand Down
Loading