From 3cafc03bcff0b6513ce942881e29a3054251b4e7 Mon Sep 17 00:00:00 2001 From: Jordi Date: Fri, 9 Feb 2024 05:29:56 +0100 Subject: [PATCH 1/3] Add links to docs, add some logging --- CHANGELOG.md | 7 +++++++ .../Exceptions/ConsiderUpgradingException.cs | 5 ++++- .../Exceptions/InvalidLicenseKeyException.cs | 5 ++++- .../Exceptions/NoSubscriptionPlanInfoException.cs | 5 ++++- .../Exceptions/NoUsageFoundException.cs | 5 ++++- .../Exceptions/RenewalRequestExpiredException.cs | 5 ++++- .../Exceptions/SubscriptionExpiredException.cs | 5 ++++- .../Exceptions/UpgradeRequestExpiredException.cs | 7 +++++-- .../CommercialLicense/SubscriptionManager.cs | 1 + src/FakeXrmEasy.Core/FakeXrmEasy.Core.csproj | 2 +- .../FakeXrmEasy.Core.Tests.csproj | 14 +++++++------- 11 files changed, 45 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3e09e217..8a53ff3d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## [2.4.2] + +### Added + +- Added link to docs in exceptions +- Added some logging in subscription usage for CI builds + ## [2.4.1] ### Changed diff --git a/src/FakeXrmEasy.Core/CommercialLicense/Exceptions/ConsiderUpgradingException.cs b/src/FakeXrmEasy.Core/CommercialLicense/Exceptions/ConsiderUpgradingException.cs index bb9c1603..89622d6f 100644 --- a/src/FakeXrmEasy.Core/CommercialLicense/Exceptions/ConsiderUpgradingException.cs +++ b/src/FakeXrmEasy.Core/CommercialLicense/Exceptions/ConsiderUpgradingException.cs @@ -7,13 +7,16 @@ namespace FakeXrmEasy.Core.CommercialLicense.Exceptions /// public class ConsiderUpgradingPlanException: Exception { + private const string _url = + "https://dynamicsvalue.github.io/fake-xrm-easy-docs/licensing/commercial-license/troubleshooting/consider-upgrading-exception/"; + /// /// Default constructor /// /// /// public ConsiderUpgradingPlanException(long currentNumberOfUsers, long allowedNumberOfUsers) : - base($"Your current subscription allows up to {allowedNumberOfUsers.ToString()}, however, {currentNumberOfUsers.ToString()} are currently using it. Please consider upgrading your current plan.") + base($"Your current subscription allows up to {allowedNumberOfUsers.ToString()} users, however, {currentNumberOfUsers.ToString()} users are currently using it. Please consider upgrading your current plan. More info at {_url}.") { } diff --git a/src/FakeXrmEasy.Core/CommercialLicense/Exceptions/InvalidLicenseKeyException.cs b/src/FakeXrmEasy.Core/CommercialLicense/Exceptions/InvalidLicenseKeyException.cs index 7879e1e6..16bca07a 100644 --- a/src/FakeXrmEasy.Core/CommercialLicense/Exceptions/InvalidLicenseKeyException.cs +++ b/src/FakeXrmEasy.Core/CommercialLicense/Exceptions/InvalidLicenseKeyException.cs @@ -7,10 +7,13 @@ namespace FakeXrmEasy.Core.CommercialLicense.Exceptions /// public class InvalidLicenseKeyException: Exception { + private const string _url = + "https://dynamicsvalue.github.io/fake-xrm-easy-docs/licensing/commercial-license/troubleshooting/invalid-license-key-exception/"; + /// /// Default constructor /// - public InvalidLicenseKeyException() : base("The license key is invalid") + public InvalidLicenseKeyException() : base($"The license key is invalid. More info at {_url}.") { } diff --git a/src/FakeXrmEasy.Core/CommercialLicense/Exceptions/NoSubscriptionPlanInfoException.cs b/src/FakeXrmEasy.Core/CommercialLicense/Exceptions/NoSubscriptionPlanInfoException.cs index 5d9c63e9..80cf264a 100644 --- a/src/FakeXrmEasy.Core/CommercialLicense/Exceptions/NoSubscriptionPlanInfoException.cs +++ b/src/FakeXrmEasy.Core/CommercialLicense/Exceptions/NoSubscriptionPlanInfoException.cs @@ -7,10 +7,13 @@ namespace FakeXrmEasy.Core.CommercialLicense.Exceptions /// public class NoSubscriptionPlanInfoException: Exception { + private const string _url = + "https://dynamicsvalue.github.io/fake-xrm-easy-docs/licensing/commercial-license/troubleshooting/no-subscription-plan-info-exception/"; + /// /// Default constructor /// - public NoSubscriptionPlanInfoException() : base("The current subscription info is unknown") + public NoSubscriptionPlanInfoException() : base($"The current subscription info is unknown. More info at {_url}.") { } diff --git a/src/FakeXrmEasy.Core/CommercialLicense/Exceptions/NoUsageFoundException.cs b/src/FakeXrmEasy.Core/CommercialLicense/Exceptions/NoUsageFoundException.cs index 0410493e..ac0b6940 100644 --- a/src/FakeXrmEasy.Core/CommercialLicense/Exceptions/NoUsageFoundException.cs +++ b/src/FakeXrmEasy.Core/CommercialLicense/Exceptions/NoUsageFoundException.cs @@ -7,10 +7,13 @@ namespace FakeXrmEasy.Core.CommercialLicense.Exceptions /// public class NoUsageFoundException: Exception { + private const string _url = + "https://dynamicsvalue.github.io/fake-xrm-easy-docs/licensing/commercial-license/troubleshooting/no-usage-found-exception/"; + /// /// Default constructor /// - public NoUsageFoundException() : base("No info about your current usage of FakeXrmEasy was found") + public NoUsageFoundException() : base($"No info about your current usage of FakeXrmEasy was found. More info at {_url}.") { } diff --git a/src/FakeXrmEasy.Core/CommercialLicense/Exceptions/RenewalRequestExpiredException.cs b/src/FakeXrmEasy.Core/CommercialLicense/Exceptions/RenewalRequestExpiredException.cs index 97c360d8..19dc3d95 100644 --- a/src/FakeXrmEasy.Core/CommercialLicense/Exceptions/RenewalRequestExpiredException.cs +++ b/src/FakeXrmEasy.Core/CommercialLicense/Exceptions/RenewalRequestExpiredException.cs @@ -7,11 +7,14 @@ namespace FakeXrmEasy.Core.CommercialLicense.Exceptions /// public class RenewalRequestExpiredException: Exception { + private const string _url = + "https://dynamicsvalue.github.io/fake-xrm-easy-docs/licensing/commercial-license/troubleshooting/renewal-request-expired-exception/"; + /// /// Throws an exception where the current subscription expired /// /// - public RenewalRequestExpiredException(DateTime expiredOn) : base($"The current subscription expired on '{expiredOn.ToLongDateString()}' and a renewal license was not applied on time. Please request a new subscription license.") + public RenewalRequestExpiredException(DateTime expiredOn) : base($"The current subscription expired on '{expiredOn.ToLongDateString()}' and a renewal license was not applied on time. Please request a new subscription license. More info at {_url}.") { } diff --git a/src/FakeXrmEasy.Core/CommercialLicense/Exceptions/SubscriptionExpiredException.cs b/src/FakeXrmEasy.Core/CommercialLicense/Exceptions/SubscriptionExpiredException.cs index 067264f1..92c68d30 100644 --- a/src/FakeXrmEasy.Core/CommercialLicense/Exceptions/SubscriptionExpiredException.cs +++ b/src/FakeXrmEasy.Core/CommercialLicense/Exceptions/SubscriptionExpiredException.cs @@ -7,11 +7,14 @@ namespace FakeXrmEasy.Core.CommercialLicense.Exceptions /// public class SubscriptionExpiredException: Exception { + private const string _url = + "https://dynamicsvalue.github.io/fake-xrm-easy-docs/licensing/commercial-license/troubleshooting/subscription-expired-exception/"; + /// /// Throws an exception where the current subscription expired /// /// - public SubscriptionExpiredException(DateTime expiredOn) : base($"The current subscription expired on {expiredOn.ToLongDateString()}") + public SubscriptionExpiredException(DateTime expiredOn) : base($"The current subscription expired on {expiredOn.ToLongDateString()}. More info at {_url}.") { } diff --git a/src/FakeXrmEasy.Core/CommercialLicense/Exceptions/UpgradeRequestExpiredException.cs b/src/FakeXrmEasy.Core/CommercialLicense/Exceptions/UpgradeRequestExpiredException.cs index dffc10a3..3e286af6 100644 --- a/src/FakeXrmEasy.Core/CommercialLicense/Exceptions/UpgradeRequestExpiredException.cs +++ b/src/FakeXrmEasy.Core/CommercialLicense/Exceptions/UpgradeRequestExpiredException.cs @@ -3,16 +3,19 @@ namespace FakeXrmEasy.Core.CommercialLicense.Exceptions { /// - /// Exception raised when the grace period for requesting an upgrade has expired + /// Exception raised when the grace period for requesting an upgrade has expired: https://dynamicsvalue.github.io/fake-xrm-easy-docs/licensing/commercial-license/troubleshooting/upgrade-request-expired-exception/ /// public class UpgradeRequestExpiredException: Exception { + private const string _url = + "https://dynamicsvalue.github.io/fake-xrm-easy-docs/licensing/commercial-license/troubleshooting/upgrade-request-expired-exception/"; + /// /// Default constructor /// /// public UpgradeRequestExpiredException(DateTime firstRequested) : - base($"You requested a subscription upgrade on '{firstRequested.ToShortDateString()}', however, the new subscription details or upgrade progress has not been completed within the allowed upgrade window. Please contact your line manager and raise a support ticket") + base($"You requested a subscription upgrade on '{firstRequested.ToShortDateString()}', however, the new subscription details or upgrade progress has not been completed within the allowed upgrade window. More info at {_url}.") { } diff --git a/src/FakeXrmEasy.Core/CommercialLicense/SubscriptionManager.cs b/src/FakeXrmEasy.Core/CommercialLicense/SubscriptionManager.cs index ddfcb4db..06794b11 100644 --- a/src/FakeXrmEasy.Core/CommercialLicense/SubscriptionManager.cs +++ b/src/FakeXrmEasy.Core/CommercialLicense/SubscriptionManager.cs @@ -82,6 +82,7 @@ internal void SetSubscriptionStorageProvider_Internal(ISubscriptionStorageProvid { if (_environmentReader.IsRunningInContinuousIntegration()) { + Console.WriteLine("Running in CI... skipping usage."); _subscriptionUsage = new SubscriptionUsage(); return; } diff --git a/src/FakeXrmEasy.Core/FakeXrmEasy.Core.csproj b/src/FakeXrmEasy.Core/FakeXrmEasy.Core.csproj index 0980fd0b..9096cbf1 100644 --- a/src/FakeXrmEasy.Core/FakeXrmEasy.Core.csproj +++ b/src/FakeXrmEasy.Core/FakeXrmEasy.Core.csproj @@ -8,7 +8,7 @@ net452 net452 FakeXrmEasy.Core - 2.4.1 + 2.4.2 Jordi Montaña Dynamics Value FakeXrmEasy Core diff --git a/tests/FakeXrmEasy.Core.Tests/FakeXrmEasy.Core.Tests.csproj b/tests/FakeXrmEasy.Core.Tests/FakeXrmEasy.Core.Tests.csproj index 579ccb29..d1c760d9 100644 --- a/tests/FakeXrmEasy.Core.Tests/FakeXrmEasy.Core.Tests.csproj +++ b/tests/FakeXrmEasy.Core.Tests/FakeXrmEasy.Core.Tests.csproj @@ -11,7 +11,7 @@ true FakeXrmEasy.CoreTests - 2.4.1 + 2.4.2 Jordi Montaña Dynamics Value S.L. Internal Unit test suite for FakeXrmEasy.Core package @@ -137,22 +137,22 @@ - + - + - + - + - + - + From 54cac0099a259752585d68d2d27a3c121c3c4a78 Mon Sep 17 00:00:00 2001 From: Jordi Date: Fri, 9 Feb 2024 05:44:36 +0100 Subject: [PATCH 2/3] See if this likes it better --- .../Exceptions/ConsiderUpgradingException.cs | 2 +- src/FakeXrmEasy.Core/DocsLinks.cs | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 src/FakeXrmEasy.Core/DocsLinks.cs diff --git a/src/FakeXrmEasy.Core/CommercialLicense/Exceptions/ConsiderUpgradingException.cs b/src/FakeXrmEasy.Core/CommercialLicense/Exceptions/ConsiderUpgradingException.cs index 89622d6f..eecc48a0 100644 --- a/src/FakeXrmEasy.Core/CommercialLicense/Exceptions/ConsiderUpgradingException.cs +++ b/src/FakeXrmEasy.Core/CommercialLicense/Exceptions/ConsiderUpgradingException.cs @@ -8,7 +8,7 @@ namespace FakeXrmEasy.Core.CommercialLicense.Exceptions public class ConsiderUpgradingPlanException: Exception { private const string _url = - "https://dynamicsvalue.github.io/fake-xrm-easy-docs/licensing/commercial-license/troubleshooting/consider-upgrading-exception/"; + CommercialLicenseTroubleshootingLinks.BaseUrl + "/consider-upgrading-exception/"; /// /// Default constructor diff --git a/src/FakeXrmEasy.Core/DocsLinks.cs b/src/FakeXrmEasy.Core/DocsLinks.cs new file mode 100644 index 00000000..79a2e9fe --- /dev/null +++ b/src/FakeXrmEasy.Core/DocsLinks.cs @@ -0,0 +1,12 @@ +namespace FakeXrmEasy +{ + internal static class DocLinks + { + internal const string BaseUrl = "https://dynamicsvalue.github.io/fake-xrm-easy-docs"; + } + + internal static class CommercialLicenseTroubleshootingLinks + { + internal const string BaseUrl = DocLinks.BaseUrl + "/licensing/commercial-license/troubleshooting"; + } +} \ No newline at end of file From d7d4b90c5212cf0b0d22c916e27fd12f7b13c92e Mon Sep 17 00:00:00 2001 From: Jordi Date: Fri, 9 Feb 2024 05:56:09 +0100 Subject: [PATCH 3/3] Replace absolute urls by relative ones --- .../CommercialLicense/Exceptions/InvalidLicenseKeyException.cs | 2 +- .../Exceptions/NoSubscriptionPlanInfoException.cs | 2 +- .../CommercialLicense/Exceptions/NoUsageFoundException.cs | 2 +- .../Exceptions/RenewalRequestExpiredException.cs | 2 +- .../Exceptions/SubscriptionExpiredException.cs | 2 +- .../Exceptions/UpgradeRequestExpiredException.cs | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/FakeXrmEasy.Core/CommercialLicense/Exceptions/InvalidLicenseKeyException.cs b/src/FakeXrmEasy.Core/CommercialLicense/Exceptions/InvalidLicenseKeyException.cs index 16bca07a..c6ee16f1 100644 --- a/src/FakeXrmEasy.Core/CommercialLicense/Exceptions/InvalidLicenseKeyException.cs +++ b/src/FakeXrmEasy.Core/CommercialLicense/Exceptions/InvalidLicenseKeyException.cs @@ -8,7 +8,7 @@ namespace FakeXrmEasy.Core.CommercialLicense.Exceptions public class InvalidLicenseKeyException: Exception { private const string _url = - "https://dynamicsvalue.github.io/fake-xrm-easy-docs/licensing/commercial-license/troubleshooting/invalid-license-key-exception/"; + CommercialLicenseTroubleshootingLinks.BaseUrl + "/invalid-license-key-exception/"; /// /// Default constructor diff --git a/src/FakeXrmEasy.Core/CommercialLicense/Exceptions/NoSubscriptionPlanInfoException.cs b/src/FakeXrmEasy.Core/CommercialLicense/Exceptions/NoSubscriptionPlanInfoException.cs index 80cf264a..b4eb8a95 100644 --- a/src/FakeXrmEasy.Core/CommercialLicense/Exceptions/NoSubscriptionPlanInfoException.cs +++ b/src/FakeXrmEasy.Core/CommercialLicense/Exceptions/NoSubscriptionPlanInfoException.cs @@ -8,7 +8,7 @@ namespace FakeXrmEasy.Core.CommercialLicense.Exceptions public class NoSubscriptionPlanInfoException: Exception { private const string _url = - "https://dynamicsvalue.github.io/fake-xrm-easy-docs/licensing/commercial-license/troubleshooting/no-subscription-plan-info-exception/"; + CommercialLicenseTroubleshootingLinks.BaseUrl + "/no-subscription-plan-info-exception/"; /// /// Default constructor diff --git a/src/FakeXrmEasy.Core/CommercialLicense/Exceptions/NoUsageFoundException.cs b/src/FakeXrmEasy.Core/CommercialLicense/Exceptions/NoUsageFoundException.cs index ac0b6940..43784811 100644 --- a/src/FakeXrmEasy.Core/CommercialLicense/Exceptions/NoUsageFoundException.cs +++ b/src/FakeXrmEasy.Core/CommercialLicense/Exceptions/NoUsageFoundException.cs @@ -8,7 +8,7 @@ namespace FakeXrmEasy.Core.CommercialLicense.Exceptions public class NoUsageFoundException: Exception { private const string _url = - "https://dynamicsvalue.github.io/fake-xrm-easy-docs/licensing/commercial-license/troubleshooting/no-usage-found-exception/"; + CommercialLicenseTroubleshootingLinks.BaseUrl + "/no-usage-found-exception/"; /// /// Default constructor diff --git a/src/FakeXrmEasy.Core/CommercialLicense/Exceptions/RenewalRequestExpiredException.cs b/src/FakeXrmEasy.Core/CommercialLicense/Exceptions/RenewalRequestExpiredException.cs index 19dc3d95..2dc9ef33 100644 --- a/src/FakeXrmEasy.Core/CommercialLicense/Exceptions/RenewalRequestExpiredException.cs +++ b/src/FakeXrmEasy.Core/CommercialLicense/Exceptions/RenewalRequestExpiredException.cs @@ -8,7 +8,7 @@ namespace FakeXrmEasy.Core.CommercialLicense.Exceptions public class RenewalRequestExpiredException: Exception { private const string _url = - "https://dynamicsvalue.github.io/fake-xrm-easy-docs/licensing/commercial-license/troubleshooting/renewal-request-expired-exception/"; + CommercialLicenseTroubleshootingLinks.BaseUrl + "/renewal-request-expired-exception/"; /// /// Throws an exception where the current subscription expired diff --git a/src/FakeXrmEasy.Core/CommercialLicense/Exceptions/SubscriptionExpiredException.cs b/src/FakeXrmEasy.Core/CommercialLicense/Exceptions/SubscriptionExpiredException.cs index 92c68d30..b7801ed8 100644 --- a/src/FakeXrmEasy.Core/CommercialLicense/Exceptions/SubscriptionExpiredException.cs +++ b/src/FakeXrmEasy.Core/CommercialLicense/Exceptions/SubscriptionExpiredException.cs @@ -8,7 +8,7 @@ namespace FakeXrmEasy.Core.CommercialLicense.Exceptions public class SubscriptionExpiredException: Exception { private const string _url = - "https://dynamicsvalue.github.io/fake-xrm-easy-docs/licensing/commercial-license/troubleshooting/subscription-expired-exception/"; + CommercialLicenseTroubleshootingLinks.BaseUrl + "/subscription-expired-exception/"; /// /// Throws an exception where the current subscription expired diff --git a/src/FakeXrmEasy.Core/CommercialLicense/Exceptions/UpgradeRequestExpiredException.cs b/src/FakeXrmEasy.Core/CommercialLicense/Exceptions/UpgradeRequestExpiredException.cs index 3e286af6..25eba04c 100644 --- a/src/FakeXrmEasy.Core/CommercialLicense/Exceptions/UpgradeRequestExpiredException.cs +++ b/src/FakeXrmEasy.Core/CommercialLicense/Exceptions/UpgradeRequestExpiredException.cs @@ -8,7 +8,7 @@ namespace FakeXrmEasy.Core.CommercialLicense.Exceptions public class UpgradeRequestExpiredException: Exception { private const string _url = - "https://dynamicsvalue.github.io/fake-xrm-easy-docs/licensing/commercial-license/troubleshooting/upgrade-request-expired-exception/"; + CommercialLicenseTroubleshootingLinks.BaseUrl + "/upgrade-request-expired-exception/"; /// /// Default constructor