def to_dict(self):
    'Return values of each fields of an jsonapi error'
    error_dict = {}
    for field in ('status', 'source', 'title', 'detail', 'id', 'code', 'links', 'meta'):
        if getattr(self, field, None):
            error_dict.update({field: getattr(self, field)})
    return error_dict
Return values of each fields of an jsonapi error
def to_dict(self):
    
    error_dict = {}
    for field in ('status', 'source', 'title', 'detail', 'id', 'code', 'links', 'meta'):
        if getattr(self, field, None):
            error_dict.update({field: getattr(self, field)})
    return error_dict