Skip to content

Commit

Permalink
Update packages, add exception handling, update error handling (#34)
Browse files Browse the repository at this point in the history
* add partner center http error codes

* add system.text.json remove newtonsoft, update hdcm package

* add try catch logic to http calls, add LogExceptionToConsole method, update json to system.text.json

* update LogExceptionToConsole

* revert back to newtonsoft json for now

* update Microsoft.Devices.HardwareDevCenterManager package to 2.2.7

* remove catch for HttpRequestException, now handled in Microsoft.Devices.HardwareDevCenterManager package

* add error code and message constants, add addtional error codes

* add EntityNotFound and RequestInvalidForCurrentState logic

* update LogExceptionToConsole summary

* code cleanup for AssemblyInfo
  • Loading branch information
Ben Carpenter authored Apr 10, 2022
1 parent ba213fe commit fab8e1f
Show file tree
Hide file tree
Showing 5 changed files with 565 additions and 406 deletions.
21 changes: 19 additions & 2 deletions SurfaceDevCenterManager/ErrorCodes.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*++
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the MIT license. See LICENSE file in the project root for full license information.
Licensed under the MIT license. See LICENSE file in the project root for full license information.
--*/

namespace SurfaceDevCenterManager
Expand Down Expand Up @@ -55,6 +55,23 @@ internal enum ErrorCodes
TRANSLATE_SUBMISSION_ID_MISSING = -44,
TRANSLATE_PUBLISHER_ID_MISSING = -45,
TRANSLATE_API_FAILED = -46,
HTTP_429_RATE_LIMIT_EXCEEDED = -429
SUBMISSION_ENTITY_NOT_FOUND = -47,
COMMIT_REQUEST_INVALID_FOR_CURRENT_STATE = -48,
HTTP_429_RATE_LIMIT_EXCEEDED = -429,
PARTNER_CENTER_HTTP_EXCEPTION = -1000
}

// https://docs.microsoft.com/en-us/windows-hardware/drivers/dashboard/get-product-data#error-codes
internal static class ErrorCodeConstants
{
public const string EntityNotFound = "entityNotFound";
public const string RequestInvalidForCurrentState = "requestInvalidForCurrentState";
}

//
internal static class ErrorMessageConstants
{
public const string OnlyPendingSubmissionsCanBeCommitted = "Only pending submissions can be committed.";
public const string InitialSubmissionAlreadyExists = "Initial submission already exists";
}
}
Loading

0 comments on commit fab8e1f

Please sign in to comment.