FileImporterException.cs 737 B

1234567891011121314151617181920212223242526
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. namespace SketchAssistantWPF
  7. {
  8. public class FileImporterException : Exception
  9. {
  10. /// <summary>
  11. /// the clean and formatted message to show to the user
  12. /// </summary>
  13. String showMessage;
  14. public FileImporterException(String message, String hint, int lineNumber) : base(message)
  15. {
  16. showMessage = "Could not import file:\n\n" + message + (hint == null ? "" : "\n(Hint: " + hint + ")") + (lineNumber == -1 ? "" : "\n\n-line: " + lineNumber);
  17. }
  18. public override string ToString()
  19. {
  20. return showMessage;
  21. }
  22. }
  23. }