Share via


How to Show Errors Returned from Windows Azure Pack Portal Server Operations

 

Applies To: Windows Azure Pack

Errors returned from server operations are made visible to the user using Progress Operations. If an operation is running successfully the following is displayed.

Windows Azure Pack Portal Operation OK

If an operation fails, the following is displayed with option to click for more details.

Windows Azure Pack Portal Server Operation Failed

Windows Azure Pack Portal Operation Failed Details

Procedure Title

  1. Set up error handling for your server-side Controller as described in Implementing a Custom Server-Side REST Endpoint. This will enable you the controller to return any PortalException as correctly-formatted JSON.

  2. In the client-side of your extension, use the following code to create the callback responsible for handling failures and set the progress operation options appropriately:

    // This would be the .fail() of some promise from an operation...
    // Assuming that progressOperation was set up earlier
    .fail(function (jqXHR, textStatus, errorThrown) {
      var message = JSON.parse(jqXHR.responseText).message;
      progressOperation.complete(
        "Unable to set plan type.",
        Shell.UI.InteractionSeverity.error,
        Shell.UI.InteractionBehavior.ok,
        (message ? { detailData : messageDetail } : null
      );
    }
    

See Also

Performing Common Tasks in a Windows Azure Pack Management Portal Extension