Skip to content

Commit 0fd05ef

Browse files
committed
Return WorkspaceLocatorErorr when unable to find workspace
1 parent 7d10122 commit 0fd05ef

1 file changed

Lines changed: 2 additions & 9 deletions

File tree

crates/pixi_core/src/workspace/discovery.rs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ pub enum DiscoveryStart {
4040

4141
impl DiscoveryStart {
4242
/// Returns the path where the search should start.
43-
pub fn path(&self) -> std::io::Result<PathBuf> {
43+
pub fn path(&self) -> miette::Result<PathBuf, WorkspaceLocatorError> {
4444
match self {
45-
DiscoveryStart::CurrentDir => std::env::current_dir(),
45+
DiscoveryStart::CurrentDir => std::env::current_dir().map_err(WorkspaceLocatorError::CurrentDir),
4646
DiscoveryStart::SearchRoot(path) => Ok(path.clone()),
4747
DiscoveryStart::ExplicitManifest(path) => Ok(path.clone()),
4848
DiscoveryStart::WorkspaceRegistry(name) => {
@@ -131,13 +131,6 @@ pub enum WorkspaceLocatorError {
131131
MissingWorkspacePath { name: String, path: PathBuf },
132132
}
133133

134-
impl From<WorkspaceLocatorError> for std::io::Error {
135-
fn from(err: WorkspaceLocatorError) -> Self {
136-
// Create a new std::io::Error, using Other kind and the source error
137-
std::io::Error::other(err)
138-
}
139-
}
140-
141134
impl WorkspaceLocator {
142135
/// Constructs a new instance tailored for finding the workspace for CLI
143136
/// commands.

0 commit comments

Comments
 (0)