Improve error message handling (#497)

- Add special handling for token expired errors so they send with a clear flag that'll allow clients to take action on this case
- Send error message instead of callstack for all messages, and ensure all resource manager paths send back inner exceptions so users can understand the true root cause.
This commit is contained in:
Kevin Cunnane
2017-10-13 17:48:25 -07:00
committed by GitHub
parent b416951414
commit 0c7f559315
17 changed files with 381 additions and 275 deletions

View File

@@ -50,9 +50,11 @@ namespace Microsoft.SqlTools.ResourceProvider.Core.Contracts
}
public class CreateFirewallRuleResponse
public class CreateFirewallRuleResponse : TokenReliantResponse
{
public bool Result { get; set; }
/// <summary>
/// An error message for why the request failed, if any
/// </summary>
public string ErrorMessage { get; set; }
}
@@ -97,6 +99,4 @@ namespace Microsoft.SqlTools.ResourceProvider.Core.Contracts
/// </summary>
public string IpAddress { get; set; }
}
}

View File

@@ -0,0 +1,28 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System.Collections.Generic;
using Microsoft.SqlTools.Hosting.Protocol.Contracts;
namespace Microsoft.SqlTools.ResourceProvider.Core.Contracts
{
/// <summary>
/// Any response which relies on a token may indicated that the operation failed due to token being expired.
/// All operational response messages should inherit from this class in order to support a standard method for defining
/// this failure path
/// </summary>
public class TokenReliantResponse
{
/// <summary>
/// Did this succeed?
/// </summary>
public bool Result { get; set; }
/// <summary>
/// If this failed, was it due to a token expiring?
/// </summary>
public bool IsTokenExpiredFailure { get; set; }
}
}