Exceptions.cs 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. using System;
  2. namespace FastReport.Utils
  3. {
  4. /// <summary>
  5. /// The exception that is thrown when the user tried to set object's name that is already exists.
  6. /// </summary>
  7. public class DuplicateNameException : Exception
  8. {
  9. internal DuplicateNameException(string name)
  10. : base(String.Format(Res.Get("Messages,DuplicateName"), name))
  11. {
  12. }
  13. }
  14. /// <summary>
  15. /// The exception that is thrown when the user tried to rename an object that is introduced in the ancestor report.
  16. /// </summary>
  17. public class AncestorException : Exception
  18. {
  19. internal AncestorException(string name)
  20. : base(String.Format(Res.Get("Messages,RenameAncestor"), name))
  21. {
  22. }
  23. }
  24. /// <summary>
  25. /// The exception that is thrown when the user tried to rename an object that is introduced in the ancestor report.
  26. /// </summary>
  27. public class SwissQrCodeException : Exception
  28. {
  29. internal SwissQrCodeException()
  30. {
  31. }
  32. internal SwissQrCodeException(string message)
  33. : base(message)
  34. {
  35. }
  36. internal SwissQrCodeException(string message, Exception inner)
  37. : base(message, inner)
  38. {
  39. }
  40. }
  41. /// <summary>
  42. /// The exception that is thrown when loading bad formed xml report file.
  43. /// </summary>
  44. public class FileFormatException : Exception
  45. {
  46. internal FileFormatException()
  47. : base(Res.Get("Messages,WrongFileFormat"))
  48. {
  49. }
  50. }
  51. /// <summary>
  52. /// The exception that is thrown when loading an encrypted report with wrong password.
  53. /// </summary>
  54. public class DecryptException : Exception
  55. {
  56. internal DecryptException()
  57. : base(Res.Get("Messages,DecryptError"))
  58. {
  59. }
  60. }
  61. /// <summary>
  62. /// The exception that is thrown if there is an error in the report's script code.
  63. /// </summary>
  64. public class CompilerException : Exception
  65. {
  66. internal CompilerException(string message)
  67. : base(message)
  68. {
  69. }
  70. }
  71. /// <summary>
  72. /// The exception that is thrown when trying to set an object's <b>Parent</b> property to
  73. /// an object that not accepts children of this type.
  74. /// </summary>
  75. public class ParentException : Exception
  76. {
  77. internal ParentException(Base parent, Base child)
  78. : base(String.Format(Res.Get("Messages,ParentError"), parent.GetType().Name, child.GetType().Name))
  79. {
  80. }
  81. }
  82. /// <summary>
  83. /// The exception that is thrown when trying to load a report file that contains reference to an
  84. /// unknown object type.
  85. /// </summary>
  86. public class ClassException : Exception
  87. {
  88. internal ClassException(string name)
  89. : base(Res.Get("Messages,CantFindObject") + " " + name)
  90. {
  91. }
  92. }
  93. /// <summary>
  94. /// The exception that is thrown when initializing a table datasource which
  95. /// <b>TableName</b> or <b>Alias</b> is not set properly.
  96. /// </summary>
  97. public class DataTableException : Exception
  98. {
  99. internal DataTableException(string alias)
  100. : base(alias + ": " + Res.Get("Messages,TableIsNull"))
  101. {
  102. }
  103. }
  104. /// <summary>
  105. /// The exception that is thrown when trying to access a row of a datasource that is not initialized yet.
  106. /// </summary>
  107. public class DataNotInitializedException : Exception
  108. {
  109. internal DataNotInitializedException(string alias)
  110. : base(alias + ": " + Res.Get("Messages,DataNotInitialized"))
  111. {
  112. }
  113. }
  114. /// <summary>
  115. /// The exception that is thrown if an error occurs in the <b>TableObject.ManualBuild</b> event.
  116. /// </summary>
  117. public class TableManualBuildException : Exception
  118. {
  119. internal TableManualBuildException()
  120. : base(Res.Get("Messages,TableManualBuildError"))
  121. {
  122. }
  123. }
  124. /// <summary>
  125. /// The exception that is thrown if an error occurs in the <b>MatrixObject.ManualBuild</b> event.
  126. /// </summary>
  127. public class MatrixValueException : Exception
  128. {
  129. internal MatrixValueException(int count)
  130. : base(String.Format(Res.Get("Messages,MatrixValueError"), count))
  131. {
  132. }
  133. }
  134. /// <summary>
  135. /// The exception that is thrown if a report object's Name property is set to wrong value.
  136. /// </summary>
  137. public class NotValidIdentifierException : Exception
  138. {
  139. internal NotValidIdentifierException(string value)
  140. : base(String.Format("'{0}' is not valid identifier name", value))
  141. {
  142. }
  143. }
  144. /// <summary>
  145. /// The exception that is thrown if an unknown value is supplied to some methods dealing with totals, variables etc.
  146. /// </summary>
  147. public class UnknownNameException : Exception
  148. {
  149. internal UnknownNameException(string value)
  150. : base(String.Format("Unknown name '{0}'", value))
  151. {
  152. }
  153. }
  154. /// <summary>
  155. /// <see cref="FastReport.Cloud.StorageClient.CloudStorageClient"/> throws this exception if an error occurs in the <b>SaveReport</b> method.
  156. /// See inner exception for detailed information.
  157. /// </summary>
  158. public class CloudStorageException : Exception
  159. {
  160. internal CloudStorageException(string message, Exception innerException) : base(message, innerException)
  161. {
  162. }
  163. }
  164. /// <summary>
  165. /// The exception that is thrown when the Group Header has no group condition.
  166. /// </summary>
  167. public class GroupHeaderHasNoGroupCondition : Exception
  168. {
  169. internal GroupHeaderHasNoGroupCondition(string name)
  170. : base(String.Format(Res.Get("Messages,GroupHeaderHasNoGroupCondition"), name))
  171. {
  172. }
  173. }
  174. }