Adding upstream version 1.3.0.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-03-17 07:33:45 +01:00
parent 6fd6eb426a
commit dc7df702ea
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
337 changed files with 16571 additions and 4891 deletions

36
asynceapi/_errors.py Normal file
View file

@ -0,0 +1,36 @@
# Copyright (c) 2024-2025 Arista Networks, Inc.
# Use of this source code is governed by the Apache License 2.0
# that can be found in the LICENSE file.
"""Exceptions for the asynceapi package."""
from __future__ import annotations
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from asynceapi._models import EapiResponse
class EapiReponseError(Exception):
"""Exception raised when an eAPI response contains errors.
Attributes
----------
response : EapiResponse
The eAPI response that contains the error.
"""
def __init__(self, response: EapiResponse) -> None:
"""Initialize the EapiReponseError exception."""
self.response = response
# Build a descriptive error message
message = "Error in eAPI response"
if response.error_code is not None:
message += f" (code: {response.error_code})"
if response.error_message is not None:
message += f": {response.error_message}"
super().__init__(message)