error.rs 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. /* This file is part of DarkFi (https://dark.fi)
  2. *
  3. * Copyright (C) 2020-2024 Dyne.org foundation
  4. *
  5. * This program is free software: you can redistribute it and/or modify
  6. * it under the terms of the GNU Affero General Public License as
  7. * published by the Free Software Foundation, either version 3 of the
  8. * License, or (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU Affero General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU Affero General Public License
  16. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  17. */
  18. pub type Result<T> = std::result::Result<T, Error>;
  19. #[repr(u8)]
  20. #[derive(Debug, Copy, Clone, thiserror::Error)]
  21. pub enum Error {
  22. #[error("Invalid scene path")]
  23. InvalidScenePath = 1,
  24. #[error("Node not found")]
  25. NodeNotFound = 2,
  26. #[error("Child node not found")]
  27. ChildNodeNotFound = 3,
  28. #[error("Parent node not found")]
  29. ParentNodeNotFound = 4,
  30. #[error("Property already exists")]
  31. PropertyAlreadyExists = 5,
  32. #[error("Property not found")]
  33. PropertyNotFound = 6,
  34. #[error("Property has wrong type")]
  35. PropertyWrongType = 7,
  36. #[error("Property has wrong subtype")]
  37. PropertyWrongSubType = 8,
  38. #[error("Property value has the wrong length")]
  39. PropertyWrongLen = 9,
  40. #[error("Property index is wrong")]
  41. PropertyWrongIndex = 10,
  42. #[error("Property out of range")]
  43. PropertyOutOfRange = 11,
  44. #[error("Property null not allowed")]
  45. PropertyNullNotAllowed = 12,
  46. #[error("Property S-exprs not allowed")]
  47. PropertySExprNotAllowed = 13,
  48. #[error("Property array is bounded length")]
  49. PropertyIsBounded = 14,
  50. #[error("Property enum item is invalid")]
  51. PropertyWrongEnumItem = 15,
  52. #[error("Signal already exists")]
  53. SignalAlreadyExists = 16,
  54. #[error("Signal not found")]
  55. SignalNotFound = 17,
  56. #[error("Slot not found")]
  57. SlotNotFound = 18,
  58. #[error("Signal already exists")]
  59. MethodAlreadyExists = 19,
  60. #[error("Method not found")]
  61. MethodNotFound = 20,
  62. #[error("Nodes are not linked")]
  63. NodesAreLinked = 21,
  64. #[error("Nodes are not linked")]
  65. NodesNotLinked = 22,
  66. #[error("Node has parents")]
  67. NodeHasParents = 23,
  68. #[error("Node has children")]
  69. NodeHasChildren = 24,
  70. #[error("Node has a parent with this name")]
  71. NodeParentNameConflict = 25,
  72. #[error("Node has a child with this name")]
  73. NodeChildNameConflict = 26,
  74. #[error("Node has a sibling with this name")]
  75. NodeSiblingNameConflict = 27,
  76. #[error("File not found")]
  77. FileNotFound = 28,
  78. #[error("Resource is not found")]
  79. ResourceNotFound = 29,
  80. #[error("Python expr eval error")]
  81. PyEvalErr = 30,
  82. #[error("Empty S-expr")]
  83. SExprEmpty = 31,
  84. #[error("S-expr global not found")]
  85. SExprGlobalNotFound = 32,
  86. #[error("Graphics window closed")]
  87. GfxWindowClosed = 33,
  88. #[error("Publisher was destroyed")]
  89. PublisherDestroyed = 34,
  90. #[error("Empty atlas")]
  91. AtlasIsEmpty = 35,
  92. #[error("Channel closed")]
  93. ChannelClosed = 36,
  94. }