-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Include troubleshooting guide link in exception messages (#31155)
* Include troubleshooting guide link in exception messages * make public
- Loading branch information
1 parent
c0dc7c9
commit 62f5cb3
Showing
6 changed files
with
64 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
sdk/servicebus/Azure.Messaging.ServiceBus/tests/Primitives/ServiceBusExceptionTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using NUnit.Framework; | ||
|
||
namespace Azure.Messaging.ServiceBus.Tests | ||
{ | ||
public class ServiceBusExceptionTests | ||
{ | ||
public static IEnumerable<object> GetFailureReasons() | ||
{ | ||
foreach (ServiceBusFailureReason reason in Enum.GetValues(typeof(ServiceBusFailureReason))) | ||
{ | ||
yield return new object[] { reason, true }; | ||
yield return new object[] { reason, false }; | ||
} | ||
} | ||
|
||
[Test] | ||
[TestCaseSource(nameof(GetFailureReasons))] | ||
public void MessageIncludesTroubleshootingGuideLink(ServiceBusFailureReason reason, bool includeEntityPath) | ||
{ | ||
var exception = new ServiceBusException("test", reason, entityPath: includeEntityPath ? "entityPath" : null); | ||
StringAssert.Contains(Constants.TroubleshootingMessage, exception.Message); | ||
|
||
// test the other constructor | ||
exception = new ServiceBusException(true, "test", reason: reason); | ||
StringAssert.Contains(Constants.TroubleshootingMessage, exception.Message); | ||
} | ||
} | ||
} |