mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-01-22 09:35:38 -05:00
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:
@@ -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; }
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -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; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user