My copy of flowroute sdk.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
flowroute-sdk-v3-python/flowroutenumbersandmessaging/exceptions/error_exception.py

40 lines
1.6 KiB

# -*- coding: utf-8 -*-
"""
flowroutenumbersandmessaging.models.error_exception
This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io )
"""
from ..api_helper import APIHelper
import flowroutenumbersandmessaging.exceptions.api_exception
import flowroutenumbersandmessaging.models.error_1
class ErrorException(flowroutenumbersandmessaging.exceptions.api_exception.APIException):
def __init__(self, reason, context):
"""Constructor for the ErrorException class
Args:
reason (string): The reason (or error message) for the Exception
to be raised.
context (HttpContext): The HttpContext of the API call.
"""
super(ErrorException, self).__init__(reason, context)
dictionary = APIHelper.json_deserialize(self.context.response.raw_body)
if isinstance(dictionary, dict):
self.unbox(dictionary)
def unbox(self, dictionary):
"""Populates the properties of this object by extracting them from a dictionary.
Args:
dictionary (dictionary): A dictionary representation of the object as
obtained from the deserialization of the server's response. The keys
MUST match property names in the API description.
"""
self.errors = None
if dictionary.get("errors") != None:
self.errors = list()
for structure in dictionary.get("errors"):
self.errors.append(flowroutenumbersandmessaging.models.error_1.Error1.from_dictionary(structure))