Exceptions.cs 6.0 KB

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