Skip to content

Commit e036be5

Browse files
committed
printing path error
1 parent 1bf9386 commit e036be5

File tree

4 files changed

+4
-7
lines changed

4 files changed

+4
-7
lines changed

src/ownership.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ use self::{
3333
pub struct Ownership {
3434
project: Arc<Project>,
3535
}
36-
36+
#[derive(Debug)]
3737
pub struct FileOwner {
3838
pub team: Team,
3939
pub team_config_file_path: String,

src/ownership/for_file_fast.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ fn load_teams(project_root: &Path, team_file_globs: &[String]) -> std::result::R
123123
match Team::from_team_file_path(path.clone()) {
124124
Ok(team) => teams.push(team),
125125
Err(e) => {
126-
eprintln!("Error parsing team file: {}", e);
126+
eprintln!("Error parsing team file: {}, path: {}", e, path.display());
127127
continue;
128128
}
129129
}

src/project.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -178,9 +178,7 @@ impl Project {
178178
}
179179

180180
pub fn relative_path<'a>(&'a self, absolute_path: &'a Path) -> &'a Path {
181-
absolute_path
182-
.strip_prefix(&self.base_path)
183-
.expect("Could not generate relative path")
181+
absolute_path.strip_prefix(&self.base_path).unwrap_or(absolute_path)
184182
}
185183

186184
pub fn get_team(&self, name: &str) -> Option<Team> {

src/runner.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,7 @@ pub fn team_for_file_from_codeowners(run_config: &RunConfig, file_path: &str) ->
8787
pub fn team_for_file(run_config: &RunConfig, file_path: &str) -> Result<Option<Team>, Error> {
8888
let config = config_from_path(&run_config.config_path)?;
8989
use crate::ownership::for_file_fast::find_file_owners;
90-
let owners = find_file_owners(&run_config.project_root, &config, std::path::Path::new(file_path))
91-
.map_err(Error::Io)?;
90+
let owners = find_file_owners(&run_config.project_root, &config, std::path::Path::new(file_path)).map_err(Error::Io)?;
9291

9392
Ok(owners.first().map(|fo| fo.team.clone()))
9493
}

0 commit comments

Comments
 (0)