Skip to main content
  • Place orders quickly and easily
  • View orders and track your shipping status
  • Enjoy members-only rewards and discounts
  • Create and access a list of your products

Dell EMC PowerFlex Manager API Guide

PDF

Exception handling

When an HTTP error code is returned the response payload contains information about the error.

An exception response was intentionally generated by trying to get a ServiceTemplate with an id that does not exist. In this case, the HTTP response was 404 and the XML response is below. See Appendix A - API reference for the relevant HTTP responses that is returned from each REST endpoint.

Here is an example of the code that is used to catch the exception and reported error:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<AsmDetailedMessageList>
  <Messages>
    <messages>
      <messageBundle>AsmManagerMessages</messageBundle>
      <messageCode>ASM0042</messageCode>
      <severity>ERROR</severity>
      <category>USER_FACING</category>
      <displayMessage>Unable to find the Template Id: ABC.</displayMessage>
      <responseAction>Make sure that a correct Template Id is entered and retry the operation. Template Ids are case sensitive. Verify the list of devices under the Summary tab to make sure whether or not the Template already exists.</responseAction>
      <detailedMessage>The Template Id cannot be found.</detailedMessage>
      <agentId>ASM Manager</agentId>
      <timeStamp>2015-03-10T14:34:24.866Z</timeStamp>
      <sequenceNumber>0</sequenceNumber>
    </messages>
  </Messages>
</AsmDetailedMessageList>
require 'ASMConfig'

templateId = "ABC"  // bogus id
url = ASM::API::URI("/ServiceTemplate/%s"%templateId)

begin
  response = ASM::API::sign {
    RestClient.get url
  }
rescue RestClient::Exception => e
  print "Got exception with status: %d\n" % e.response.code
  print "%s\n" % e.response
end

Rate this content

Accurate
Useful
Easy to understand
Was this article helpful?
0/3000 characters
  Please provide ratings (1-5 stars).
  Please provide ratings (1-5 stars).
  Please provide ratings (1-5 stars).
  Please select whether the article was helpful or not.
  Comments cannot contain these special characters: <>()\