ANTFS_Exception.cs 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /*
  2. This software is subject to the license described in the License.txt file
  3. included with this software distribution. You may not use this file except
  4. in compliance with this license.
  5. Copyright (c) Dynastream Innovations Inc. 2016
  6. All rights reserved.
  7. */
  8. using System;
  9. using System.Collections.Generic;
  10. using System.Text;
  11. namespace ANT_Managed_Library.ANTFS
  12. {
  13. /// <summary>
  14. /// Exceptions thrown by ANT-FS objects
  15. /// </summary>
  16. public class ANTFS_Exception : ANT_Exception
  17. {
  18. /// <summary>
  19. /// Constructor
  20. /// </summary>
  21. /// <param name="exceptionDetail">String to append to exception message</param>
  22. internal ANTFS_Exception(String exceptionDetail) : base("ANTFS - " + exceptionDetail) { }
  23. /// <summary>
  24. /// Prefixes given string with "ANTLibrary Exception: " and propagates inner exception
  25. /// </summary>
  26. /// <param name="exceptionDetail">String to prefix</param>
  27. /// <param name="innerException">Inner exception</param>
  28. internal ANTFS_Exception(String exceptionDetail, Exception innerException) : base("ANTFS - " + exceptionDetail, innerException) { }
  29. }
  30. /// <summary>
  31. /// Exceptions thrown by ANT-FS objects when a request to perform a specific operation failed
  32. /// Developers must ensure that these exceptions are handled appropiately to continue with the program execution
  33. /// </summary>
  34. public class ANTFS_RequestFailed_Exception : ANTFS_Exception
  35. {
  36. /// <summary>
  37. /// Constructor
  38. /// </summary>
  39. /// <param name="strOperation">Requested operation that failed</param>
  40. /// <param name="theReturn">ANT-FS Library return code</param>
  41. internal ANTFS_RequestFailed_Exception(string strOperation, ReturnCode theReturn) : base(strOperation + " Request Failed: " + Print.AsString(theReturn)) { }
  42. /// <summary>
  43. /// Constructor
  44. /// </summary>
  45. /// <param name="exceptionDetail">Requested operation that failed</param>
  46. internal ANTFS_RequestFailed_Exception(string exceptionDetail) : base(exceptionDetail) { }
  47. }
  48. }