# Module `netapp_ontap.error`

Copyright © 2021 NetApp Inc. All rights reserved.

This module defines the custom exception type. All exceptions raised by the library descend from this type.

## Classes

`class NetAppRestError (message: str = None, cause: Exception = None)`

  Common base class for all exceptions raised by the library functions. All custom exceptions are derived from this type.

  Initalize the error object.

  Optionally accepts a custom message and cause. If provided, the cause is the exception object that was handled when this exception is created.

  ## Args

  `message`
    A human readable message that explains the error.
  `cause`
    An exception object that caused this exception to be raised.

  ### Ancestors

  - builtins.Exception
  - builtins.BaseException

  ### Instance variables

  `http_err_response`

    Describes a response to an API request that contains an error.

    ## Returns

    Response object if the exception was raised because of an API failure (HTTP status code of 400 or higher). None if the exception was not related to an API error.

  `response_body`

    Return the HTTP response body if this error was generated from a failed HTTP request. The body will be in dictionary form. If this exception is not from a failed request or the body cannot be parsed as JSON, returns None

  `response_text`

    Return the HTTP response body if this error was generated from a failed HTTP request. This will be the raw text of the response body. This is useful when the response body cannot be parsed as JSON.

  `status_code`

    Return the status code of the HTTP response if this error was generated from a failed HTTP request. Otherwise, returns None