You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

52 lines
1001 B

  1. use std::io::Error as IoError;
  2. use serde_yaml::Error as YamlError;
  3. use thiserror::Error;
  4. use vfs::VfsError;
  5. use vfs_zip::Error as VfsZipError;
  6. #[derive(Debug, Error)]
  7. pub enum Error {
  8. #[error("IO Error: {0}")]
  9. IoError(IoError),
  10. #[error("VFS Error: {0}")]
  11. VfsError(VfsError),
  12. #[error("VFS ZIP Error: {0}")]
  13. VfsZipError(VfsZipError),
  14. #[error("YAML Error: {0}")]
  15. YamlError(YamlError),
  16. #[error("Resource is not registered: {0}!")]
  17. ResourceNotRegistered(&'static str),
  18. #[error("Unable to initialize VFS!")]
  19. InitVFS,
  20. }
  21. impl From<IoError> for Error {
  22. fn from(err: IoError) -> Self {
  23. Self::IoError(err)
  24. }
  25. }
  26. impl From<VfsError> for Error {
  27. fn from(err: VfsError) -> Self {
  28. Self::VfsError(err)
  29. }
  30. }
  31. impl From<VfsZipError> for Error {
  32. fn from(err: VfsZipError) -> Self {
  33. Self::VfsZipError(err)
  34. }
  35. }
  36. impl From<YamlError> for Error {
  37. fn from(err: YamlError) -> Self {
  38. Self::YamlError(err)
  39. }
  40. }