1use std::path::PathBuf;
2
3pub type Result<T> = std::result::Result<T, Error>;
4
5#[derive(Debug, thiserror::Error)]
6pub enum Error {
7 #[error("My Settings not found (MYSETTING.DAT, MYSETTING2.DAT, DJMMYSETTING.DAT, DEVSETTING.DAT). Searched: {}. Open rekordbox Preferences > DJ System > My Settings once so rekordbox writes them, or pass --settings-dir.", searched.iter().map(|p| p.display().to_string()).collect::<Vec<_>>().join(", "))]
8 SettingsNotFound { searched: Vec<PathBuf> },
9
10 #[error("Playlist not found: {0}")]
11 PlaylistNotFound(String),
12
13 #[error("Playlist '{path}' is not a TrackID-referenced playlist (KeyType={key_type}); only KeyType=\"0\" playlists can be exported")]
14 UnsupportedPlaylistType { path: String, key_type: String },
15
16 #[error("No exportable playlists selected")]
17 NoPlaylists,
18
19 #[error("No rekordbox analysis files found. Searched: {}. Pass --anlz-dir pointing at rekordbox's PIONEER/USBANLZ directory.", searched.iter().map(|p| p.display().to_string()).collect::<Vec<_>>().join(", "))]
20 NoAnlzRoot { searched: Vec<PathBuf> },
21
22 #[error("None of the selected tracks can be exported (missing source files or analysis)")]
23 NothingToExport,
24
25 #[error("Device path is not a directory: {}", .0.display())]
26 DeviceNotFound(PathBuf),
27
28 #[error("operation cancelled")]
29 Cancelled,
30
31 #[error(transparent)]
32 Io(#[from] std::io::Error),
33
34 #[error(transparent)]
35 Other(#[from] anyhow::Error),
36}