Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.

using System.Net.Http;
using System.Threading.Tasks;
using Microsoft.Azure.PowerShell.Cmdlets.Support.Models;

namespace Microsoft.Azure.PowerShell.Cmdlets.Support.Cmdlets
{
public partial class NewAzSupportCommunication_CreateExpanded
{
partial void overrideOnDefault(HttpResponseMessage responseMessage, Task<IErrorResponse> errorResponseTask, ref Task<bool> returnNow)
{
this.WriteError(responseMessage, errorResponseTask, ref returnNow);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.

using System.Net.Http;
using System.Threading.Tasks;
using Microsoft.Azure.PowerShell.Cmdlets.Support.Models;

namespace Microsoft.Azure.PowerShell.Cmdlets.Support.Cmdlets
{
public partial class NewAzSupportCommunicationsNoSubscription_CreateExpanded
{
partial void overrideOnDefault(HttpResponseMessage responseMessage, Task<IErrorResponse> errorResponseTask, ref Task<bool> returnNow)
{
this.WriteError(responseMessage, errorResponseTask, ref returnNow);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.

using System.Net.Http;
using System.Threading.Tasks;
using Microsoft.Azure.PowerShell.Cmdlets.Support.Models;

namespace Microsoft.Azure.PowerShell.Cmdlets.Support.Cmdlets
{
public partial class NewAzSupportTicket_CreateExpanded
{
partial void overrideOnDefault(HttpResponseMessage responseMessage, Task<IErrorResponse> errorResponseTask, ref Task<bool> returnNow)
{
this.WriteError(responseMessage, errorResponseTask, ref returnNow);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.

using System.Net.Http;
using System.Threading.Tasks;
using Microsoft.Azure.PowerShell.Cmdlets.Support.Models;

namespace Microsoft.Azure.PowerShell.Cmdlets.Support.Cmdlets
{
public partial class NewAzSupportTicketsNoSubscription_CreateExpanded
{
partial void overrideOnDefault(HttpResponseMessage responseMessage, Task<IErrorResponse> errorResponseTask, ref Task<bool> returnNow)
{
this.WriteError(responseMessage, errorResponseTask, ref returnNow);
}
}
}
24 changes: 24 additions & 0 deletions src/Support/Support.Autorest/custom/csharp/RestErrorHandler.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.

using System.Management.Automation;
using System.Net.Http;
using System.Threading.Tasks;
using Microsoft.Azure.PowerShell.Cmdlets.Support.Models;

namespace Microsoft.Azure.PowerShell.Cmdlets.Support.Cmdlets
{
internal static class CmdletRestExtension
{
public static void WriteError(this Cmdlet cmdlet, HttpResponseMessage responseMessage, Task<IErrorResponse> errorResponseTask, ref Task<bool> returnNow)
{
var errorString = responseMessage.Content.ReadAsStringAsync().ConfigureAwait(false).GetAwaiter().GetResult();
cmdlet.WriteError(new ErrorRecord(new System.Exception(), null, ErrorCategory.InvalidOperation, null)
{
ErrorDetails = new ErrorDetails(errorString) { RecommendedAction = string.Empty }
});

returnNow = Task.FromResult(true);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.

using System.Net.Http;
using System.Threading.Tasks;
using Microsoft.Azure.PowerShell.Cmdlets.Support.Models;

namespace Microsoft.Azure.PowerShell.Cmdlets.Support.Cmdlets
{
public partial class UpdateAzSupportTicket_UpdateExpanded
{
partial void overrideOnDefault(HttpResponseMessage responseMessage, Task<IErrorResponse> errorResponseTask, ref Task<bool> returnNow)
{
this.WriteError(responseMessage, errorResponseTask, ref returnNow);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.

using System.Net.Http;
using System.Threading.Tasks;
using Microsoft.Azure.PowerShell.Cmdlets.Support.Models;

namespace Microsoft.Azure.PowerShell.Cmdlets.Support.Cmdlets
{
public partial class UpdateAzSupportTicket_UpdateViaIdentityExpanded
{
partial void overrideOnDefault(HttpResponseMessage responseMessage, Task<IErrorResponse> errorResponseTask, ref Task<bool> returnNow)
{
this.WriteError(responseMessage, errorResponseTask, ref returnNow);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.

using System.Net.Http;
using System.Threading.Tasks;
using Microsoft.Azure.PowerShell.Cmdlets.Support.Models;

namespace Microsoft.Azure.PowerShell.Cmdlets.Support.Cmdlets
{
public partial class UpdateAzSupportTicketsNoSubscription_UpdateExpanded
{
partial void overrideOnDefault(HttpResponseMessage responseMessage, Task<IErrorResponse> errorResponseTask, ref Task<bool> returnNow)
{
this.WriteError(responseMessage, errorResponseTask, ref returnNow);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.

using System.Net.Http;
using System.Threading.Tasks;
using Microsoft.Azure.PowerShell.Cmdlets.Support.Models;

namespace Microsoft.Azure.PowerShell.Cmdlets.Support.Cmdlets
{
public partial class UpdateAzSupportTicketsNoSubscription_UpdateViaIdentityExpanded
{
partial void overrideOnDefault(HttpResponseMessage responseMessage, Task<IErrorResponse> errorResponseTask, ref Task<bool> returnNow)
{
this.WriteError(responseMessage, errorResponseTask, ref returnNow);
}
}
}