error.rs 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. use std::fmt::Debug;
  2. pub enum GetKeyError {
  3. KeyNotExists,
  4. InternalError(String)
  5. }
  6. impl Debug for GetKeyError {
  7. fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
  8. match self {
  9. GetKeyError::KeyNotExists => write!(f, "KeyNotExists"),
  10. GetKeyError::InternalError(v) => write!(f, "InternalError: {}", v),
  11. }
  12. }
  13. }
  14. pub enum MountError {
  15. InvalidAfsHandle,
  16. InternalError(String),
  17. MountPointAlreadyMounted,
  18. }
  19. impl Debug for MountError {
  20. fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
  21. match self {
  22. MountError::InvalidAfsHandle => write!(f, "InvalidAfsHandle"),
  23. MountError::InternalError(v) => write!(f, "InternalError: {}", v),
  24. MountError::MountPointAlreadyMounted => write!(f, "MountPointAlreadyMounted"),
  25. }
  26. }
  27. }
  28. pub enum AfsFreeError {
  29. InvalidAfsHandle,
  30. InternalError(String),
  31. }
  32. impl Debug for AfsFreeError {
  33. fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
  34. match self {
  35. AfsFreeError::InvalidAfsHandle => write!(f, "InvalidAfsHandle"),
  36. AfsFreeError::InternalError(v) => write!(f, "InternalError: {}", v),
  37. }
  38. }
  39. }
  40. pub enum MkdirError {
  41. InternalError(String),
  42. }
  43. impl Debug for MkdirError {
  44. fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
  45. match self {
  46. MkdirError::InternalError(v) => write!(f, "InternalError: {}", v),
  47. }
  48. }
  49. }
  50. pub enum AfsMkdirError {
  51. InvalidAfsHandle,
  52. InternalError(String),
  53. }
  54. impl Debug for AfsMkdirError {
  55. fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
  56. match self {
  57. AfsMkdirError::InvalidAfsHandle => write!(f, "InvalidAfsHandle"),
  58. AfsMkdirError::InternalError(v) => write!(f, "InternalError: {}", v),
  59. }
  60. }
  61. }
  62. pub enum CreateBepOvfsError {
  63. CreateAfsInstanceFailed,
  64. MemeoryReadOutOfBounds,
  65. EmptyFsLayerArray,
  66. InvalidArrayElementLength,
  67. InvalidHandle,
  68. UnknownError(i32),
  69. }
  70. impl Debug for CreateBepOvfsError {
  71. fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
  72. match self {
  73. CreateBepOvfsError::CreateAfsInstanceFailed => write!(f, "CreateAfsInstanceFailed"),
  74. CreateBepOvfsError::MemeoryReadOutOfBounds => write!(f, "MemeoryReadOutOfBounds"),
  75. CreateBepOvfsError::EmptyFsLayerArray => write!(f, "EmptyFsLayerArray"),
  76. CreateBepOvfsError::InvalidArrayElementLength => write!(f, "InvalidArrayElementLength"),
  77. CreateBepOvfsError::InvalidHandle => write!(f, "InvalidHandle"),
  78. CreateBepOvfsError::UnknownError(ec) => write!(f, "UnknownError: code={}", ec),
  79. }
  80. }
  81. }