error.rs 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /// The error types.
  2. #[derive(thiserror::Error, Debug)]
  3. pub enum Error {
  4. /// The extract archive error.
  5. #[error("Extract Error: {0}")]
  6. Extract(String),
  7. /// The Command (spawn process) error.
  8. #[error("Command Error: {0}")]
  9. Command(String),
  10. /// The path operation error.
  11. #[error("Path Error: {0}")]
  12. Path(String),
  13. /// Error showing the dialog.
  14. #[error("Dialog Error: {0}")]
  15. Dialog(String),
  16. /// The dialog operation was cancelled by the user.
  17. #[error("user cancelled the dialog")]
  18. DialogCancelled,
  19. /// CLI config not set.
  20. #[error("CLI configuration not set on tauri.conf.json")]
  21. CliNotConfigured,
  22. /// The network error.
  23. #[error("Network Error: {0}")]
  24. Network(#[from] reqwest::Error),
  25. /// HTTP method error.
  26. #[error("{0}")]
  27. HttpMethod(#[from] http::method::InvalidMethod),
  28. /// Invalid HTTO header.
  29. #[error("{0}")]
  30. HttpHeader(#[from] reqwest::header::InvalidHeaderName),
  31. /// Failed to serialize header value as string.
  32. #[error("failed to convert response header value to string")]
  33. HttpHeaderToString(#[from] reqwest::header::ToStrError),
  34. /// HTTP form to must be an object.
  35. #[error("http form must be an object")]
  36. InvalidHttpForm,
  37. /// Semver error.
  38. #[error("{0}")]
  39. Semver(#[from] semver::SemVerError),
  40. /// JSON error.
  41. #[error("{0}")]
  42. Json(#[from] serde_json::Error),
  43. /// IO error.
  44. #[error("{0}")]
  45. Io(#[from] std::io::Error),
  46. /// ZIP error.
  47. #[error("{0}")]
  48. Zip(#[from] zip::result::ZipError),
  49. /// Notification error.
  50. #[cfg(feature = "notification")]
  51. #[error("{0}")]
  52. Notification(#[from] notify_rust::error::Error),
  53. /// failed to detect the current platform.
  54. #[error("failed to detect platform: {0}")]
  55. FailedToDetectPlatform(String),
  56. /// CLI argument parsing error.
  57. #[cfg(feature = "cli")]
  58. #[error("failed to parse CLI arguments: {0}")]
  59. ParseCliArguments(#[from] clap::Error),
  60. /// Shortcut error.
  61. #[cfg(feature = "global-shortcut")]
  62. #[error("shortcut error: {0}")]
  63. Shortcut(#[from] tauri_hotkey::Error),
  64. }