NotInitializedException.cs 1.1 KB

1234567891011121314151617181920212223
  1. namespace Terminal.Gui.App;
  2. /// <summary>
  3. /// Thrown when user code attempts to access a property or perform a method
  4. /// Exception type thrown when trying to use a property or method
  5. /// that is only supported after initialization, e.g. of an <see cref="IApplicationMainLoop{T}"/>
  6. /// </summary>
  7. public class NotInitializedException : InvalidOperationException
  8. {
  9. /// <summary>
  10. /// Creates a new instance of the exception indicating that the class
  11. /// <paramref name="memberName"/> cannot be used until owner is initialized.
  12. /// </summary>
  13. /// <param name="memberName">Property or method name</param>
  14. public NotInitializedException (string memberName) : base ($"{memberName} cannot be accessed before Initialization") { }
  15. /// <summary>
  16. /// Creates a new instance of the exception with the full message/inner exception.
  17. /// </summary>
  18. /// <param name="msg"></param>
  19. /// <param name="innerException"></param>
  20. public NotInitializedException (string msg, Exception innerException) : base (msg, innerException) { }
  21. }