Coverage for pyVHDLModel/Exception.py: 91%
485 statements
« prev ^ index » next coverage.py v7.17.0, created at 2026-10-22 19:31 +0000
« prev ^ index » next coverage.py v7.17.0, created at 2026-10-22 19:31 +0000
1# ==================================================================================================================== #
2# __ ___ _ ____ _ __ __ _ _ #
3# _ __ _ \ \ / / | | | _ \| | | \/ | ___ __| | ___| | #
4# | '_ \| | | \ \ / /| |_| | | | | | | |\/| |/ _ \ / _` |/ _ \ | #
5# | |_) | |_| |\ V / | _ | |_| | |___| | | | (_) | (_| | __/ | #
6# | .__/ \__, | \_/ |_| |_|____/|_____|_| |_|\___/ \__,_|\___|_| #
7# |_| |___/ #
8# ==================================================================================================================== #
9# Authors: #
10# Patrick Lehmann #
11# #
12# License: #
13# ==================================================================================================================== #
14# Copyright 2017-2026 Patrick Lehmann - Boetzingen, Germany #
15# Copyright 2016-2017 Patrick Lehmann - Dresden, Germany #
16# #
17# Licensed under the Apache License, Version 2.0 (the "License"); #
18# you may not use this file except in compliance with the License. #
19# You may obtain a copy of the License at #
20# #
21# http://www.apache.org/licenses/LICENSE-2.0 #
22# #
23# Unless required by applicable law or agreed to in writing, software #
24# distributed under the License is distributed on an "AS IS" BASIS, #
25# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
26# See the License for the specific language governing permissions and #
27# limitations under the License. #
28# #
29# SPDX-License-Identifier: Apache-2.0 #
30# ==================================================================================================================== #
31#
32"""
33This module contains parts of an abstract document language model for VHDL.
35The module ``Exceptions`` contains all structured errors that are raised by pyVHDLModel. Besides a default error
36message in english, each exception object contains one or multiple references to the exception's context.
37"""
38from __future__ import annotations
40from typing import TYPE_CHECKING, Optional as Nullable, Union
42from pyTooling.Decorators import export, readonly
43from pyTooling.Exceptions import ExceptionBase, AlreadyInHierarchyError, DuplicateElementError
44from pyTooling.Warning import Warning, CriticalWarning
46from pyVHDLModel.Symbol import Symbol
48if TYPE_CHECKING: # pragma: no cover
49 from pyVHDLModel.Base import ModelElementUnion, ModelEntity
50 from pyVHDLModel.Concurrent import ComponentInstantiation
51 from pyVHDLModel.DesignUnit import Component as _Component
52 from pyVHDLModel.Namespace import Namespace as _Namespace
55@export
56class VHDLModelWarning(Warning):
57 """
58 Base-class for the non-critical warnings raised by pyVHDLModel.
60 .. attention::
62 It's a non-critical warning: without a :class:`~pyTooling.Warning.WarningCollector` up the call-hierarchy, it's
63 dropped silently.
65 .. seealso::
67 * :class:`Not implemented warning <pyVHDLModel.Exception.NotImplementedWarning>`
68 * :class:`Blackbox warning <pyVHDLModel.Exception.BlackboxWarning>`
69 """
70 pass
73@export
74class NotImplementedWarning(VHDLModelWarning):
75 """
76 Raised when a language construct is recognised but not yet modelled.
78 .. attention::
80 It's a non-critical warning: without a :class:`~pyTooling.Warning.WarningCollector` up the call-hierarchy, it's
81 dropped silently.
82 """
84 _item: Nullable[Union[ModelEntity, Symbol]] #: The model element or symbol of the construct.
86 def __init__(self, message: str, /, *, item: Nullable[Union[ModelEntity, Symbol]] = None) -> None:
87 """
88 Initializes the warning with the construct that isn't modelled yet.
90 :param message: The warning's message.
91 :param item: Optional, the model element or symbol of the construct - a declared item, an expression, a symbol
92 or an instantiation.
93 """
94 super().__init__(message)
95 self._item = item
97 @readonly
98 def Item(self) -> Nullable[Union[ModelEntity, Symbol]]:
99 """
100 Read-only property to access the model element or symbol of the construct (:attr:`_item`).
102 :returns: The model element or symbol, or ``None`` if the construct has none or it wasn't recorded.
103 """
104 return self._item
107@export
108class VHDLModelCriticalWarning(CriticalWarning):
109 """
110 Base-class for critical warnings that likely indicate a defect in the model or its input.
112 .. important::
114 As a critical warning, it must be collected by a :class:`~pyTooling.Warning.WarningCollector` up the
115 call-hierarchy, otherwise :exc:`~pyTooling.Warning.UnhandledCriticalWarningError` is raised.
117 .. seealso::
119 * :class:`Duplicate declaration warning <pyVHDLModel.Exception.DuplicateDeclarationWarning>`
120 """
121 pass
124@export
125class DuplicateDeclarationWarning(VHDLModelCriticalWarning):
126 """
127 Raised when two declarations in one declarative region share an identifier.
129 VHDL rejects this as *identifier already used for a declaration*. Overloadable declarations -
130 subprograms differing in signature - are not reported. Afterwards, the namespace refers to the later declaration.
132 .. important::
134 As a critical warning, it must be collected by a :class:`~pyTooling.Warning.WarningCollector` up the
135 call-hierarchy, otherwise :exc:`~pyTooling.Warning.UnhandledCriticalWarningError` is raised.
136 """
138 _identifier: Nullable[str] #: The identifier declared twice.
139 _normalizedIdentifier: Nullable[str] #: The normalized (lower case) identifier.
140 _namespace: Nullable[_Namespace] #: The namespace of the declarative region declaring it.
141 _element: Nullable[ModelEntity] #: The new declaration.
142 _existing: Nullable[ModelEntity] #: The earlier declaration.
144 def __init__(
145 self,
146 message: str,
147 /, *,
148 identifier: Nullable[str] = None,
149 namespace: Nullable[_Namespace] = None,
150 element: Nullable[ModelEntity] = None,
151 existing: Nullable[ModelEntity] = None
152 ) -> None:
153 """
154 Initializes the warning with the identifier, the namespace and both declarations.
156 :param message: The warning's message.
157 :param identifier: Optional, the identifier declared twice.
158 :param namespace: Optional, the namespace of the declarative region declaring it.
159 :param element: Optional, the new declaration.
160 :param existing: Optional, the earlier declaration.
161 """
162 super().__init__(message)
163 self._identifier = identifier
164 self._normalizedIdentifier = identifier.lower() if identifier is not None else None
165 self._namespace = namespace
166 self._element = element
167 self._existing = existing
169 @readonly
170 def Identifier(self) -> Nullable[str]:
171 """
172 Read-only property to access the identifier declared twice (:attr:`_identifier`).
174 :returns: The identifier, or ``None`` if it wasn't recorded.
175 """
176 return self._identifier
178 @readonly
179 def NormalizedIdentifier(self) -> Nullable[str]:
180 """
181 Read-only property to access the normalized (lower case) identifier (:attr:`_normalizedIdentifier`).
183 :returns: The normalized identifier, or ``None`` if it wasn't recorded.
184 """
185 return self._normalizedIdentifier
187 @readonly
188 def Namespace(self) -> Nullable[_Namespace]:
189 """
190 Read-only property to access the namespace of the declarative region declaring it (:attr:`_namespace`).
192 :returns: The namespace, or ``None`` if it wasn't recorded.
193 """
194 return self._namespace
196 @readonly
197 def Element(self) -> Nullable[ModelEntity]:
198 """
199 Read-only property to access the new declaration (:attr:`_element`).
201 :returns: The declaration, or ``None`` if it wasn't recorded.
202 """
203 return self._element
205 @readonly
206 def Existing(self) -> Nullable[ModelEntity]:
207 """
208 Read-only property to access the earlier declaration (:attr:`_existing`).
210 :returns: The declaration, or ``None`` if it wasn't recorded.
211 """
212 return self._existing
215@export
216class BlackboxWarning(VHDLModelWarning):
217 """
218 Raised when a component could not be bound and is treated as a blackbox.
220 Only a component allowing blackboxes - set on it or inherited, e.g. from its library or design
221 (:attr:`~pyVHDLModel.Common.AllowBlackboxMixin.AllowBlackbox`) - becomes a blackbox, recorded in
222 :attr:`Component.IsBlackbox <pyVHDLModel.DesignUnit.Component.IsBlackbox>`. For any other component without an
223 entity, analysis raises a :exc:`VHDLModelException`.
225 .. attention::
227 It's a non-critical warning: without a :class:`~pyTooling.Warning.WarningCollector` up the call-hierarchy, it's
228 dropped silently.
229 """
231 _instance: Nullable[ComponentInstantiation] #: The component instantiation treated as a blackbox.
232 _component: Nullable[_Component] #: The component that couldn't be bound.
234 def __init__(
235 self,
236 message: str,
237 /, *,
238 instance: Nullable[ComponentInstantiation] = None,
239 component: Nullable[_Component] = None
240 ) -> None:
241 """
242 Initializes the warning with the instantiation and the component that couldn't be bound.
244 :param message: The warning's message.
245 :param instance: Optional, the component instantiation treated as a blackbox.
246 :param component: Optional, the component that couldn't be bound.
247 """
248 super().__init__(message)
249 self._instance = instance
250 self._component = component
252 @readonly
253 def Instance(self) -> Nullable[ComponentInstantiation]:
254 """
255 Read-only property to access the component instantiation treated as a blackbox (:attr:`_instance`).
257 :returns: The instantiation, or ``None`` if it wasn't recorded.
258 """
259 return self._instance
261 @readonly
262 def Component(self) -> Nullable[_Component]:
263 """
264 Read-only property to access the component that couldn't be bound (:attr:`_component`).
266 :returns: The component, or ``None`` if it wasn't recorded.
267 """
268 return self._component
271@export
272class VHDLModelException(ExceptionBase):
273 """
274 Base-class for all exceptions (errors) raised by pyVHDLModel.
276 .. seealso::
278 * :class:`Library exists in design error <pyVHDLModel.Exception.LibraryExistsInDesignError>`
279 * :class:`Registered to foreign design error <pyVHDLModel.Exception.LibraryRegisteredToForeignDesignError>`
280 * :class:`Library not registered error <pyVHDLModel.Exception.LibraryNotRegisteredError>`
281 * :class:`Entity exists in library error <pyVHDLModel.Exception.EntityExistsInLibraryError>`
282 * :class:`Architecture exists in library error <pyVHDLModel.Exception.ArchitectureExistsInLibraryError>`
283 * :class:`Package exists in library error <pyVHDLModel.Exception.PackageExistsInLibraryError>`
284 * :class:`Package body exists error <pyVHDLModel.Exception.PackageBodyExistsError>`
285 * :class:`Configuration exists in library error <pyVHDLModel.Exception.ConfigurationExistsInLibraryError>`
286 * :class:`Context exists in library error <pyVHDLModel.Exception.ContextExistsInLibraryError>`
287 * :class:`Referenced library not existing error <pyVHDLModel.Exception.ReferencedLibraryNotExistingError>`
288 * :class:`Already in design error <pyVHDLModel.Exception.AlreadyInDesignError>`
289 * :class:`Not a child error <pyVHDLModel.Exception.NotAChildError>`
290 * :class:`Duplicate generic error <pyVHDLModel.Exception.DuplicateGenericError>`
291 * :class:`Duplicate port error <pyVHDLModel.Exception.DuplicatePortError>`
292 * :class:`Duplicate parameter error <pyVHDLModel.Exception.DuplicateParameterError>`
293 * :class:`Not in namespace error <pyVHDLModel.Exception.NotInNamespaceError>`
294 * :class:`Duplicate declaration error <pyVHDLModel.Exception.DuplicateDeclarationError>`
295 * :class:`Duplicate association error <pyVHDLModel.Exception.DuplicateAssociationError>`
296 * :class:`Association order error <pyVHDLModel.Exception.AssociationOrderError>`
297 * :class:`Library not found error <pyVHDLModel.Exception.LibraryNotFoundError>`
298 * :class:`Entity not found error <pyVHDLModel.Exception.EntityNotFoundError>`
299 * :class:`Package not found error <pyVHDLModel.Exception.PackageNotFoundError>`
300 * :class:`Configuration not found error <pyVHDLModel.Exception.ConfigurationNotFoundError>`
301 * :class:`Context not found error <pyVHDLModel.Exception.ContextNotFoundError>`
302 * :class:`VHDL writer error <pyVHDLModel.Exception.VHDLWriterError>`
303 """
306@export
307class LibraryExistsInDesignError(VHDLModelException):
308 """
309 This exception is raised, when the library is already existing in the design.
311 Message: :pycode:`f"Library '{library._identifier}' already exists in design."`
312 """
314 _library: Library #: The library involved in this error.
316 def __init__(self, library: Library) -> None:
317 """
318 Initializes the exception message based on given library object.
320 :param library: The library that already exists in the design.
321 """
322 super().__init__(f"Library '{library._identifier}' already exists in design.")
323 self._library = library
325 @readonly
326 def Library(self) -> Library:
327 """
328 Read-only property to access the duplicate library (:attr:`_library`).
330 :returns: Duplicate library (by name).
331 """
332 return self._library
335@export
336class LibraryRegisteredToForeignDesignError(VHDLModelException):
337 """
338 This exception is raised, when the library is already registered to a foreign design.
340 Message: :pycode:`f"Library '{library._identifier}' already registered in design '{library.Parent}'."`
341 """
343 _library: Library #: The library involved in this error.
345 def __init__(self, library: Library) -> None:
346 """
347 Initializes the exception message based on given library object.
349 :param library: The library that is already registered to another design.
350 """
351 super().__init__(f"Library '{library._identifier}' already registered in design '{library.Parent}'.")
352 self._library = library
354 @readonly
355 def Library(self) -> Library:
356 """
357 Read-only property to access the library (:attr:`_library`).
359 :returns: The library.
360 """
361 return self._library
364@export
365class LibraryNotRegisteredError(VHDLModelException):
366 """
367 This exception is raised, when the library is not registered in the design.
369 Message: :pycode:`f"Library '{library._identifier}' is not registered in the design."`
370 """
372 _library: Library #: The library involved in this error.
374 def __init__(self, library: Library) -> None:
375 """
376 Initializes the exception message based on given library object.
378 :param library: The library that isn't registered in the design.
379 """
380 super().__init__(f"Library '{library._identifier}' is not registered in the design.")
381 self._library = library
383 @readonly
384 def Library(self) -> Library:
385 """
386 Read-only property to access the library (:attr:`_library`).
388 :returns: The library.
389 """
390 return self._library
393@export
394class EntityExistsInLibraryError(VHDLModelException):
395 """
396 This exception is raised, when the entity already existing in the library.
398 Message: :pycode:`f"Entity '{entity._identifier}' already exists in library '{library._identifier}'."`
399 """
401 _library: Library #: The library involved in this error.
402 _entity: Entity #: The entity involved in this error.
404 def __init__(self, entity: Entity, library: Library) -> None:
405 """
406 Initializes the exception message based on given entity and library objects.
408 :param entity: The entity that already exists in the library.
409 :param library: The library that already contains the entity.
410 """
411 super().__init__(f"Entity '{entity._identifier}' already exists in library '{library._identifier}'.")
412 self._library = library
413 self._entity = entity
415 @readonly
416 def Library(self) -> Library:
417 """
418 Read-only property to access the library (:attr:`_library`).
420 :returns: The library.
421 """
422 return self._library
424 @readonly
425 def Entity(self) -> Entity:
426 """
427 Read-only property to access the entity (:attr:`_entity`).
429 :returns: The entity.
430 """
431 return self._entity
434@export
435class ArchitectureExistsInLibraryError(VHDLModelException):
436 """
437 This exception is raised, when the architecture already existing in the library.
439 Message: :pycode:`f"Architecture '{architecture._identifier}' for entity '{entity._identifier}' already exists in library '{library._identifier}'."`
440 """
442 _library: Library #: The library involved in this error.
443 _entity: Entity #: The entity involved in this error.
444 _architecture: Architecture #: The architecture involved in this error.
446 def __init__(self, architecture: Architecture, entity: Entity, library: Library) -> None:
447 """
448 Initializes the exception message based on given architecture, entity and library objects.
450 :param architecture: The architecture that already exists in the library.
451 :param entity: The entity the architecture refers to, which already exists in the library.
452 :param library: The library that already contains the architecture.
453 """
454 super().__init__(f"Architecture '{architecture._identifier}' for entity '{entity._identifier}' already exists in library '{library._identifier}'.")
455 self._library = library
456 self._entity = entity
457 self._architecture = architecture
459 @readonly
460 def Library(self) -> Library:
461 """
462 Read-only property to access the library (:attr:`_library`).
464 :returns: The library.
465 """
466 return self._library
468 @readonly
469 def Entity(self) -> Entity:
470 """
471 Read-only property to access the entity (:attr:`_entity`).
473 :returns: The entity.
474 """
475 return self._entity
477 @readonly
478 def Architecture(self) -> Architecture:
479 """
480 Read-only property to access the architecture (:attr:`_architecture`).
482 :returns: The architecture.
483 """
484 return self._architecture
487@export
488class PackageExistsInLibraryError(VHDLModelException):
489 """
490 This exception is raised, when the package already existing in the library.
492 Message: :pycode:`f"Package '{package._identifier}' already exists in library '{library._identifier}'."`
493 """
495 _library: Library #: The library involved in this error.
496 _package: Package #: The package involved in this error.
498 def __init__(self, package: Package, library: Library) -> None:
499 """
500 Initializes the exception message based on given package and library objects.
502 :param package: The package that already exists in the library.
503 :param library: The library that already contains the package.
504 """
505 super().__init__(f"Package '{package._identifier}' already exists in library '{library._identifier}'.")
506 self._library = library
507 self._package = package
509 @readonly
510 def Library(self) -> Library:
511 """
512 Read-only property to access the library (:attr:`_library`).
514 :returns: The library.
515 """
516 return self._library
518 @readonly
519 def Package(self) -> Package:
520 """
521 Read-only property to access the package (:attr:`_package`).
523 :returns: The package.
524 """
525 return self._package
528@export
529class PackageBodyExistsError(VHDLModelException):
530 """
531 This exception is raised, when the package body already existing in the library.
533 Message: :pycode:`f"Package body '{packageBody._identifier}' already exists in library '{library._identifier}'."`
534 """
536 _library: Library #: The library involved in this error.
537 _packageBody: PackageBody #: The package body involved in this error.
539 def __init__(self, packageBody: PackageBody, library: Library) -> None:
540 """
541 Initializes the exception message based on given package body and library objects.
543 :param packageBody: The package body that already exists in the library.
544 :param library: The library that already contains the package body.
545 """
546 super().__init__(f"Package body '{packageBody._identifier}' already exists in library '{library._identifier}'.")
547 self._library = library
548 self._packageBody = packageBody
550 @readonly
551 def Library(self) -> Library:
552 """
553 Read-only property to access the library (:attr:`_library`).
555 :returns: The library.
556 """
557 return self._library
559 @readonly
560 def PackageBody(self) -> PackageBody:
561 """
562 Read-only property to access the package body (:attr:`_packageBody`).
564 :returns: The package body.
565 """
566 return self._packageBody
569@export
570class ConfigurationExistsInLibraryError(VHDLModelException):
571 """
572 This exception is raised, when the configuration already existing in the library.
574 Message: :pycode:`f"Configuration '{configuration._identifier}' already exists in library '{library._identifier}'."`
575 """
577 _library: Library #: The library involved in this error.
578 _configuration: Configuration #: The configuration involved in this error.
580 def __init__(self, configuration: Configuration, library: Library) -> None:
581 """
582 Initializes the exception message based on given configuration and library objects.
584 :param configuration: The configuration that already exists in the library.
585 :param library: The library that already contains the configuration.
586 """
587 super().__init__(f"Configuration '{configuration._identifier}' already exists in library '{library._identifier}'.")
588 self._library = library
589 self._configuration = configuration
591 @readonly
592 def Library(self) -> Library:
593 """
594 Read-only property to access the library (:attr:`_library`).
596 :returns: The library.
597 """
598 return self._library
600 @readonly
601 def Configuration(self) -> Configuration:
602 """
603 Read-only property to access the configuration (:attr:`_configuration`).
605 :returns: The configuration.
606 """
607 return self._configuration
610@export
611class ContextExistsInLibraryError(VHDLModelException):
612 """
613 This exception is raised, when the context already existing in the library.
615 Message: :pycode:`f"Context '{context._identifier}' already exists in library '{library._identifier}'."`
616 """
618 _library: Library #: The library involved in this error.
619 _context: Context #: The context involved in this error.
621 def __init__(self, context: Context, library: Library) -> None:
622 """
623 Initializes the exception message based on given context and library objects.
625 :param context: The context that already exists in the library.
626 :param library: The library that already contains the context.
627 """
628 super().__init__(f"Context '{context._identifier}' already exists in library '{library._identifier}'.")
629 self._library = library
630 self._context = context
632 @readonly
633 def Library(self) -> Library:
634 """
635 Read-only property to access the library (:attr:`_library`).
637 :returns: The library.
638 """
639 return self._library
641 @readonly
642 def Context(self) -> Context:
643 """
644 Read-only property to access the context (:attr:`_context`).
646 :returns: The context.
647 """
648 return self._context
651@export
652class ReferencedLibraryNotExistingError(VHDLModelException):
653 """
654 This exception is raised, when a library is referenced by a `library clause`, but doesn't exist in the design.
656 Message: :pycode:`f"Library '{librarySymbol.Name._identifier}' referenced by library clause of context '{context._identifier}' doesn't exist in design."`
657 """
659 _librarySymbol: Symbol #: The library symbol that could not be resolved.
660 _context: Context #: The context involved in this error.
662 def __init__(self, context: Context, librarySymbol: Symbol) -> None:
663 """
664 Initializes the exception message based on given context and library objects.
666 :param context: The context that already exists in the library.
667 :param librarySymbol: The library that already contains the context.
668 """
669 super().__init__(f"Library '{librarySymbol.Name._identifier}' referenced by library clause of context '{context._identifier}' doesn't exist in design.")
670 self._librarySymbol = librarySymbol
671 self._context = context
673 @readonly
674 def LibrarySymbol(self) -> Symbol:
675 """
676 Read-only property to access the library symbol (:attr:`_librarySymbol`).
678 :returns: The library symbol.
679 """
680 return self._librarySymbol
682 @readonly
683 def Context(self) -> Context:
684 """
685 Read-only property to access the context (:attr:`_context`).
687 :returns: The context.
688 """
689 return self._context
692@export
693class AlreadyInDesignError(VHDLModelException, AlreadyInHierarchyError):
694 """
695 This exception is raised, when a model entity is added to a parent, but it already has a parent.
697 .. hint::
699 Remove the model entity from its current parent first, e.g. by
700 :meth:`~pyVHDLModel.Regions.WithGenericsMixin.RemoveGenericItem`.
701 """
703 _element: Nullable[ModelEntity] #: The model entity to add.
704 _parent: Nullable[ModelEntity] #: The model entity's current parent.
706 def __init__(
707 self,
708 message: str,
709 /, *,
710 element: Nullable[ModelEntity] = None,
711 parent: Nullable[ModelEntity] = None
712 ) -> None:
713 """
714 Initializes the exception with the model entity and its current parent.
716 :param message: The error message.
717 :param element: Optional, the model entity to add.
718 :param parent: Optional, the model entity's current parent.
719 """
720 super().__init__(message)
721 self._element = element
722 self._parent = parent
724 @readonly
725 def Element(self) -> Nullable[ModelEntity]:
726 """
727 Read-only property to access the model entity to add (:attr:`_element`).
729 :returns: The model entity, or ``None`` if it wasn't recorded.
730 """
731 return self._element
733 @readonly
734 def Parent(self) -> Nullable[ModelEntity]:
735 """
736 Read-only property to access the model entity's current parent (:attr:`_parent`).
738 :returns: The parent, or ``None`` if it wasn't recorded.
739 """
740 return self._parent
743@export
744class NotAChildError(VHDLModelException):
745 """
746 This exception is raised, when a model entity is removed from a parent, but it isn't a child of that parent.
747 """
749 _element: Nullable[ModelEntity] #: The model entity, which isn't a child.
750 _parent: Nullable[ModelEntity] #: The model entity searched for the child.
752 def __init__(
753 self,
754 message: str,
755 /, *,
756 element: Nullable[ModelEntity] = None,
757 parent: Nullable[ModelEntity] = None
758 ) -> None:
759 """
760 Initializes the exception with the model entity and the parent searched for it.
762 :param message: The error message.
763 :param element: Optional, the model entity, which isn't a child.
764 :param parent: Optional, the model entity searched for the child.
765 """
766 super().__init__(message)
767 self._element = element
768 self._parent = parent
770 @readonly
771 def Element(self) -> Nullable[ModelEntity]:
772 """
773 Read-only property to access the model entity, which isn't a child (:attr:`_element`).
775 :returns: The model entity, or ``None`` if it wasn't recorded.
776 """
777 return self._element
779 @readonly
780 def Parent(self) -> Nullable[ModelEntity]:
781 """
782 Read-only property to access the model entity searched for the child (:attr:`_parent`).
784 :returns: The parent, or ``None`` if it wasn't recorded.
785 """
786 return self._parent
789@export
790class NotInNamespaceError(VHDLModelException, KeyError):
791 """
792 This exception is raised, when an element isn't declared in a namespace under the given identifier.
794 It's a :exc:`KeyError` too, like removing a missing key from a dictionary.
795 """
797 _identifier: Nullable[str] #: The identifier looked up.
798 _normalizedIdentifier: Nullable[str] #: The normalized (lower case) identifier.
799 _namespace: Nullable[_Namespace] #: The namespace searched for the identifier.
801 def __init__(
802 self,
803 message: str,
804 /, *,
805 identifier: Nullable[str] = None,
806 namespace: Nullable[_Namespace] = None
807 ) -> None:
808 """
809 Initializes the exception with the identifier and the namespace searched for it.
811 :param message: The error message.
812 :param identifier: Optional, the identifier looked up.
813 :param namespace: Optional, the namespace searched for the identifier.
814 """
815 super().__init__(message)
816 self._identifier = identifier
817 self._normalizedIdentifier = identifier.lower() if identifier is not None else None
818 self._namespace = namespace
820 @readonly
821 def Identifier(self) -> Nullable[str]:
822 """
823 Read-only property to access the identifier looked up (:attr:`_identifier`).
825 :returns: The identifier, or ``None`` if it wasn't recorded.
826 """
827 return self._identifier
829 @readonly
830 def NormalizedIdentifier(self) -> Nullable[str]:
831 """
832 Read-only property to access the normalized (lower case) identifier (:attr:`_normalizedIdentifier`).
834 :returns: The normalized identifier, or ``None`` if it wasn't recorded.
835 """
836 return self._normalizedIdentifier
838 @readonly
839 def Namespace(self) -> Nullable[_Namespace]:
840 """
841 Read-only property to access the namespace searched for the identifier (:attr:`_namespace`).
843 :returns: The namespace, or ``None`` if it wasn't recorded.
844 """
845 return self._namespace
847 def __str__(self) -> str:
848 """
849 Return the exception's message.
851 :returns: The message, without the quotes :exc:`KeyError` adds.
852 """
853 return self.args[0]
856@export
857class DuplicateGenericError(VHDLModelException, DuplicateElementError):
858 """
859 This exception is raised, when a language construct already has a generic of the same identifier.
860 """
862 _identifier: Nullable[str] #: The identifier declared twice.
863 _normalizedIdentifier: Nullable[str] #: The normalized (lower case) identifier.
864 _parent: Nullable[ModelEntity] #: The language construct owning the generic clause.
865 _element: Nullable[ModelEntity] #: The new generic.
866 _existing: Nullable[ModelEntity] #: The existing declaration.
868 def __init__(
869 self,
870 message: str,
871 /, *,
872 identifier: Nullable[str] = None,
873 parent: Nullable[ModelEntity] = None,
874 element: Nullable[ModelEntity] = None,
875 existing: Nullable[ModelEntity] = None
876 ) -> None:
877 """
878 Initializes the exception with the identifier, the language construct and both declarations.
880 :param message: The error message.
881 :param identifier: Optional, the identifier declared twice.
882 :param parent: Optional, the language construct owning the generic clause.
883 :param element: Optional, the new generic.
884 :param existing: Optional, the existing declaration.
885 """
886 super().__init__(message)
887 self._identifier = identifier
888 self._normalizedIdentifier = identifier.lower() if identifier is not None else None
889 self._parent = parent
890 self._element = element
891 self._existing = existing
893 @readonly
894 def Identifier(self) -> Nullable[str]:
895 """
896 Read-only property to access the identifier declared twice (:attr:`_identifier`).
898 :returns: The identifier, or ``None`` if it wasn't recorded.
899 """
900 return self._identifier
902 @readonly
903 def NormalizedIdentifier(self) -> Nullable[str]:
904 """
905 Read-only property to access the normalized (lower case) identifier (:attr:`_normalizedIdentifier`).
907 :returns: The normalized identifier, or ``None`` if it wasn't recorded.
908 """
909 return self._normalizedIdentifier
911 @readonly
912 def Parent(self) -> Nullable[ModelEntity]:
913 """
914 Read-only property to access the language construct owning the generic clause (:attr:`_parent`).
916 :returns: The language construct, or ``None`` if it wasn't recorded.
917 """
918 return self._parent
920 @readonly
921 def Element(self) -> Nullable[ModelEntity]:
922 """
923 Read-only property to access the new generic (:attr:`_element`).
925 :returns: The generic, or ``None`` if it wasn't recorded.
926 """
927 return self._element
929 @readonly
930 def Existing(self) -> Nullable[ModelEntity]:
931 """
932 Read-only property to access the existing declaration (:attr:`_existing`).
934 :returns: The declaration, or ``None`` if it wasn't recorded.
935 """
936 return self._existing
939@export
940class DuplicatePortError(VHDLModelException, DuplicateElementError):
941 """
942 This exception is raised, when a language construct already has a port of the same identifier.
943 """
945 _identifier: Nullable[str] #: The identifier declared twice.
946 _normalizedIdentifier: Nullable[str] #: The normalized (lower case) identifier.
947 _parent: Nullable[ModelEntity] #: The language construct owning the port clause.
948 _element: Nullable[ModelEntity] #: The new port.
949 _existing: Nullable[ModelEntity] #: The existing declaration.
951 def __init__(
952 self,
953 message: str,
954 /, *,
955 identifier: Nullable[str] = None,
956 parent: Nullable[ModelEntity] = None,
957 element: Nullable[ModelEntity] = None,
958 existing: Nullable[ModelEntity] = None
959 ) -> None:
960 """
961 Initializes the exception with the identifier, the language construct and both declarations.
963 :param message: The error message.
964 :param identifier: Optional, the identifier declared twice.
965 :param parent: Optional, the language construct owning the port clause.
966 :param element: Optional, the new port.
967 :param existing: Optional, the existing declaration.
968 """
969 super().__init__(message)
970 self._identifier = identifier
971 self._normalizedIdentifier = identifier.lower() if identifier is not None else None
972 self._parent = parent
973 self._element = element
974 self._existing = existing
976 @readonly
977 def Identifier(self) -> Nullable[str]:
978 """
979 Read-only property to access the identifier declared twice (:attr:`_identifier`).
981 :returns: The identifier, or ``None`` if it wasn't recorded.
982 """
983 return self._identifier
985 @readonly
986 def NormalizedIdentifier(self) -> Nullable[str]:
987 """
988 Read-only property to access the normalized (lower case) identifier (:attr:`_normalizedIdentifier`).
990 :returns: The normalized identifier, or ``None`` if it wasn't recorded.
991 """
992 return self._normalizedIdentifier
994 @readonly
995 def Parent(self) -> Nullable[ModelEntity]:
996 """
997 Read-only property to access the language construct owning the port clause (:attr:`_parent`).
999 :returns: The language construct, or ``None`` if it wasn't recorded.
1000 """
1001 return self._parent
1003 @readonly
1004 def Element(self) -> Nullable[ModelEntity]:
1005 """
1006 Read-only property to access the new port (:attr:`_element`).
1008 :returns: The port, or ``None`` if it wasn't recorded.
1009 """
1010 return self._element
1012 @readonly
1013 def Existing(self) -> Nullable[ModelEntity]:
1014 """
1015 Read-only property to access the existing declaration (:attr:`_existing`).
1017 :returns: The declaration, or ``None`` if it wasn't recorded.
1018 """
1019 return self._existing
1022@export
1023class DuplicateParameterError(VHDLModelException, DuplicateElementError):
1024 """
1025 This exception is raised, when a language construct already has a parameter of the same identifier.
1026 """
1028 _identifier: Nullable[str] #: The identifier declared twice.
1029 _normalizedIdentifier: Nullable[str] #: The normalized (lower case) identifier.
1030 _parent: Nullable[ModelEntity] #: The language construct owning the parameter list.
1031 _element: Nullable[ModelEntity] #: The new parameter.
1032 _existing: Nullable[ModelEntity] #: The existing declaration.
1034 def __init__(
1035 self,
1036 message: str,
1037 /, *,
1038 identifier: Nullable[str] = None,
1039 parent: Nullable[ModelEntity] = None,
1040 element: Nullable[ModelEntity] = None,
1041 existing: Nullable[ModelEntity] = None
1042 ) -> None:
1043 """
1044 Initializes the exception with the identifier, the language construct and both declarations.
1046 :param message: The error message.
1047 :param identifier: Optional, the identifier declared twice.
1048 :param parent: Optional, the language construct owning the parameter list.
1049 :param element: Optional, the new parameter.
1050 :param existing: Optional, the existing declaration.
1051 """
1052 super().__init__(message)
1053 self._identifier = identifier
1054 self._normalizedIdentifier = identifier.lower() if identifier is not None else None
1055 self._parent = parent
1056 self._element = element
1057 self._existing = existing
1059 @readonly
1060 def Identifier(self) -> Nullable[str]:
1061 """
1062 Read-only property to access the identifier declared twice (:attr:`_identifier`).
1064 :returns: The identifier, or ``None`` if it wasn't recorded.
1065 """
1066 return self._identifier
1068 @readonly
1069 def NormalizedIdentifier(self) -> Nullable[str]:
1070 """
1071 Read-only property to access the normalized (lower case) identifier (:attr:`_normalizedIdentifier`).
1073 :returns: The normalized identifier, or ``None`` if it wasn't recorded.
1074 """
1075 return self._normalizedIdentifier
1077 @readonly
1078 def Parent(self) -> Nullable[ModelEntity]:
1079 """
1080 Read-only property to access the language construct owning the parameter list (:attr:`_parent`).
1082 :returns: The language construct, or ``None`` if it wasn't recorded.
1083 """
1084 return self._parent
1086 @readonly
1087 def Element(self) -> Nullable[ModelEntity]:
1088 """
1089 Read-only property to access the new parameter (:attr:`_element`).
1091 :returns: The parameter, or ``None`` if it wasn't recorded.
1092 """
1093 return self._element
1095 @readonly
1096 def Existing(self) -> Nullable[ModelEntity]:
1097 """
1098 Read-only property to access the existing declaration (:attr:`_existing`).
1100 :returns: The declaration, or ``None`` if it wasn't recorded.
1101 """
1102 return self._existing
1105@export
1106class DuplicateDeclarationError(VHDLModelException, DuplicateElementError):
1107 """
1108 This exception is raised, when a declarative region already declares an identifier of a declared item.
1110 It's raised for declared items without a more specific error, and it's the base-class of the more specific errors.
1111 Subprograms are overloadable, so a subprogram sharing its identifier with another subprogram is no duplicate.
1113 .. seealso::
1115 * :class:`Duplicate type error <pyVHDLModel.Exception.DuplicateTypeError>`
1116 * :class:`Duplicate subtype error <pyVHDLModel.Exception.DuplicateSubtypeError>`
1117 * :class:`Duplicate constant error <pyVHDLModel.Exception.DuplicateConstantError>`
1118 * :class:`Duplicate signal error <pyVHDLModel.Exception.DuplicateSignalError>`
1119 * :class:`Duplicate variable error <pyVHDLModel.Exception.DuplicateVariableError>`
1120 * :class:`Duplicate file error <pyVHDLModel.Exception.DuplicateFileError>`
1121 * :class:`Duplicate component error <pyVHDLModel.Exception.DuplicateComponentError>`
1122 * :class:`Duplicate subprogram error <pyVHDLModel.Exception.DuplicateSubprogramError>`
1123 * :class:`Duplicate label error <pyVHDLModel.Exception.DuplicateLabelError>`
1124 """
1126 _identifier: Nullable[str] #: The identifier declared twice.
1127 _normalizedIdentifier: Nullable[str] #: The normalized (lower case) identifier.
1128 _namespace: Nullable[_Namespace] #: The namespace of the declarative region declaring it.
1129 _element: Nullable[ModelEntity] #: The new declaration.
1130 _existing: Nullable[ModelEntity] #: The existing declaration.
1132 def __init__(
1133 self,
1134 message: str,
1135 /, *,
1136 identifier: Nullable[str] = None,
1137 namespace: Nullable[_Namespace] = None,
1138 element: Nullable[ModelEntity] = None,
1139 existing: Nullable[ModelEntity] = None
1140 ) -> None:
1141 """
1142 Initializes the exception with the identifier, the namespace and both declarations.
1144 :param message: The error message.
1145 :param identifier: Optional, the identifier declared twice.
1146 :param namespace: Optional, the namespace of the declarative region declaring it.
1147 :param element: Optional, the new declaration.
1148 :param existing: Optional, the existing declaration.
1149 """
1150 super().__init__(message)
1151 self._identifier = identifier
1152 self._normalizedIdentifier = identifier.lower() if identifier is not None else None
1153 self._namespace = namespace
1154 self._element = element
1155 self._existing = existing
1157 @readonly
1158 def Identifier(self) -> Nullable[str]:
1159 """
1160 Read-only property to access the identifier declared twice (:attr:`_identifier`).
1162 :returns: The identifier, or ``None`` if it wasn't recorded.
1163 """
1164 return self._identifier
1166 @readonly
1167 def NormalizedIdentifier(self) -> Nullable[str]:
1168 """
1169 Read-only property to access the normalized (lower case) identifier (:attr:`_normalizedIdentifier`).
1171 :returns: The normalized identifier, or ``None`` if it wasn't recorded.
1172 """
1173 return self._normalizedIdentifier
1175 @readonly
1176 def Namespace(self) -> Nullable[_Namespace]:
1177 """
1178 Read-only property to access the namespace of the declarative region declaring it (:attr:`_namespace`).
1180 :returns: The namespace, or ``None`` if it wasn't recorded.
1181 """
1182 return self._namespace
1184 @readonly
1185 def Element(self) -> Nullable[ModelEntity]:
1186 """
1187 Read-only property to access the new declaration (:attr:`_element`).
1189 :returns: The declaration, or ``None`` if it wasn't recorded.
1190 """
1191 return self._element
1193 @readonly
1194 def Existing(self) -> Nullable[ModelEntity]:
1195 """
1196 Read-only property to access the existing declaration (:attr:`_existing`).
1198 :returns: The declaration, or ``None`` if it wasn't recorded.
1199 """
1200 return self._existing
1203@export
1204class DuplicateTypeError(DuplicateDeclarationError):
1205 """
1206 This exception is raised, when a declarative region already declares the identifier of a new type.
1207 """
1210@export
1211class DuplicateSubtypeError(DuplicateDeclarationError):
1212 """
1213 This exception is raised, when a declarative region already declares the identifier of a new subtype.
1214 """
1217@export
1218class DuplicateConstantError(DuplicateDeclarationError):
1219 """
1220 This exception is raised, when a declarative region already declares the identifier of a new constant.
1221 """
1224@export
1225class DuplicateSignalError(DuplicateDeclarationError):
1226 """
1227 This exception is raised, when a declarative region already declares the identifier of a new signal.
1228 """
1231@export
1232class DuplicateVariableError(DuplicateDeclarationError):
1233 """
1234 This exception is raised, when a declarative region already declares the identifier of a new (shared) variable.
1235 """
1238@export
1239class DuplicateFileError(DuplicateDeclarationError):
1240 """
1241 This exception is raised, when a declarative region already declares the identifier of a new file.
1242 """
1245@export
1246class DuplicateComponentError(DuplicateDeclarationError):
1247 """
1248 This exception is raised, when a declarative region already declares the identifier of a new component.
1249 """
1252@export
1253class DuplicateSubprogramError(DuplicateDeclarationError):
1254 """
1255 This exception is raised, when a declarative region already declares the identifier of a new subprogram.
1257 Subprograms are overloadable, so only a declaration other than a subprogram is a duplicate.
1258 """
1261@export
1262class DuplicateLabelError(DuplicateDeclarationError):
1263 """
1264 This exception is raised, when a declarative region already declares the label of a new statement.
1266 A statement label is declared implicitly in the declarative region enclosing the statement, so it clashes with
1267 another label and with a declaration of the same identifier.
1268 """
1271@export
1272class DuplicateAssociationError(VHDLModelException, DuplicateElementError):
1273 """
1274 This exception is raised, when an association list already associates the formal of a new named association.
1276 It's the base-class of the errors for generic, port and parameter associations.
1278 .. seealso::
1280 * :class:`Duplicate generic association error <pyVHDLModel.Exception.DuplicateGenericAssociationError>`
1281 * :class:`Duplicate port association error <pyVHDLModel.Exception.DuplicatePortAssociationError>`
1282 * :class:`Duplicate parameter association error <pyVHDLModel.Exception.DuplicateParameterAssociationError>`
1283 """
1285 _identifier: Nullable[str] #: The formal associated twice.
1286 _normalizedIdentifier: Nullable[str] #: The normalized (lower case) formal.
1287 _parent: Nullable[ModelEntity] #: The language construct owning the association list.
1288 _element: Nullable[ModelEntity] #: The new association.
1289 _existing: Nullable[ModelEntity] #: The existing association.
1291 def __init__(
1292 self,
1293 message: str,
1294 /, *,
1295 identifier: Nullable[str] = None,
1296 parent: Nullable[ModelEntity] = None,
1297 element: Nullable[ModelEntity] = None,
1298 existing: Nullable[ModelEntity] = None
1299 ) -> None:
1300 """
1301 Initializes the exception with the formal, the language construct and both associations.
1303 :param message: The error message.
1304 :param identifier: Optional, the formal associated twice.
1305 :param parent: Optional, the language construct owning the association list.
1306 :param element: Optional, the new association.
1307 :param existing: Optional, the existing association.
1308 """
1309 super().__init__(message)
1310 self._identifier = identifier
1311 self._normalizedIdentifier = identifier.lower() if identifier is not None else None
1312 self._parent = parent
1313 self._element = element
1314 self._existing = existing
1316 @readonly
1317 def Identifier(self) -> Nullable[str]:
1318 """
1319 Read-only property to access the formal associated twice (:attr:`_identifier`).
1321 :returns: The formal's identifier, or ``None`` if it wasn't recorded.
1322 """
1323 return self._identifier
1325 @readonly
1326 def NormalizedIdentifier(self) -> Nullable[str]:
1327 """
1328 Read-only property to access the normalized (lower case) formal (:attr:`_normalizedIdentifier`).
1330 :returns: The normalized identifier, or ``None`` if it wasn't recorded.
1331 """
1332 return self._normalizedIdentifier
1334 @readonly
1335 def Parent(self) -> Nullable[ModelEntity]:
1336 """
1337 Read-only property to access the language construct owning the association list (:attr:`_parent`).
1339 :returns: The language construct, or ``None`` if it wasn't recorded.
1340 """
1341 return self._parent
1343 @readonly
1344 def Element(self) -> Nullable[ModelEntity]:
1345 """
1346 Read-only property to access the new association (:attr:`_element`).
1348 :returns: The association, or ``None`` if it wasn't recorded.
1349 """
1350 return self._element
1352 @readonly
1353 def Existing(self) -> Nullable[ModelEntity]:
1354 """
1355 Read-only property to access the existing association (:attr:`_existing`).
1357 :returns: The association, or ``None`` if it wasn't recorded.
1358 """
1359 return self._existing
1362@export
1363class DuplicateGenericAssociationError(DuplicateAssociationError):
1364 """
1365 This exception is raised, when a generic map aspect already associates the formal of a new generic association.
1366 """
1369@export
1370class DuplicatePortAssociationError(DuplicateAssociationError):
1371 """
1372 This exception is raised, when a port map aspect already associates the formal of a new port association.
1373 """
1376@export
1377class DuplicateParameterAssociationError(DuplicateAssociationError):
1378 """
1379 This exception is raised, when a procedure call already associates the formal of a new parameter association.
1380 """
1383@export
1384class AssociationOrderError(VHDLModelException):
1385 """
1386 This exception is raised, when a new association breaks the order of an association list.
1388 All positional associations of an association list precede its named associations: the existing association is a
1389 named association preceding a new positional association, or a positional association following a new named
1390 association.
1391 """
1393 _parent: Nullable[ModelEntity] #: The language construct owning the association list.
1394 _element: Nullable[ModelEntity] #: The new association.
1395 _existing: Nullable[ModelEntity] #: The existing association, the new association is out of order with.
1397 def __init__(
1398 self,
1399 message: str,
1400 /, *,
1401 parent: Nullable[ModelEntity] = None,
1402 element: Nullable[ModelEntity] = None,
1403 existing: Nullable[ModelEntity] = None
1404 ) -> None:
1405 """
1406 Initializes the exception with the language construct and both associations.
1408 :param message: The error message.
1409 :param parent: Optional, the language construct owning the association list.
1410 :param element: Optional, the new association.
1411 :param existing: Optional, the existing association, the new association is out of order with.
1412 """
1413 super().__init__(message)
1414 self._parent = parent
1415 self._element = element
1416 self._existing = existing
1418 @readonly
1419 def Parent(self) -> Nullable[ModelEntity]:
1420 """
1421 Read-only property to access the language construct owning the association list (:attr:`_parent`).
1423 :returns: The language construct, or ``None`` if it wasn't recorded.
1424 """
1425 return self._parent
1427 @readonly
1428 def Element(self) -> Nullable[ModelEntity]:
1429 """
1430 Read-only property to access the new association (:attr:`_element`).
1432 :returns: The association, or ``None`` if it wasn't recorded.
1433 """
1434 return self._element
1436 @readonly
1437 def Existing(self) -> Nullable[ModelEntity]:
1438 """
1439 Read-only property to access the existing association, the new association is out of order with
1440 (:attr:`_existing`).
1442 :returns: The association, or ``None`` if it wasn't recorded.
1443 """
1444 return self._existing
1447@export
1448class LibraryNotFoundError(VHDLModelException):
1449 """
1450 This exception is raised, when a library is looked up by name, but doesn't exist in the design.
1452 Message: :pycode:`f"Library '{libraryName}' not found in design."`
1453 """
1455 _libraryName: str #: The name of the library, which was not found.
1457 def __init__(self, libraryName: str) -> None:
1458 """
1459 Initializes the exception message based on the given library name.
1461 :param libraryName: The name of the library, which was not found.
1462 """
1463 super().__init__(f"Library '{libraryName}' not found in design.")
1464 self._libraryName = libraryName
1466 @readonly
1467 def LibraryName(self) -> str:
1468 """
1469 Read-only property to access the library name (:attr:`_libraryName`).
1471 :returns: The name of the library, which was not found.
1472 """
1473 return self._libraryName
1476@export
1477class DesignUnitNotFoundError(Exception):
1478 """
1479 The exception is raised when a design unit is looked up by name, but doesn't exist in the searched library.
1481 It's a common base: a kind-specific exception derives from it and from :exc:`VHDLModelException`, e.g.
1482 ``class EntityNotFoundError(VHDLModelException, DesignUnitNotFoundError)``. It has no initializer of its own; the
1483 derived exception sets the fields.
1485 .. seealso::
1487 :exc:`~pyVHDLModel.Exception.EntityNotFoundError`
1488 |rarr| Entity not found.
1489 :exc:`~pyVHDLModel.Exception.PackageNotFoundError`
1490 |rarr| Package not found.
1491 :exc:`~pyVHDLModel.Exception.ConfigurationNotFoundError`
1492 |rarr| Configuration not found.
1493 :exc:`~pyVHDLModel.Exception.ContextNotFoundError`
1494 |rarr| Context not found.
1495 """
1497 _designUnitName: str #: The name of the design unit, which was not found.
1498 _libraryName: str #: The name of the searched library.
1500 @readonly
1501 def DesignUnitName(self) -> str:
1502 """
1503 Read-only property to access the design unit name (:attr:`_designUnitName`).
1505 :returns: The name of the design unit, which was not found.
1506 """
1507 return self._designUnitName
1509 @readonly
1510 def LibraryName(self) -> str:
1511 """
1512 Read-only property to access the library name (:attr:`_libraryName`).
1514 :returns: The name of the searched library.
1515 """
1516 return self._libraryName
1519@export
1520class EntityNotFoundError(VHDLModelException, DesignUnitNotFoundError):
1521 """
1522 This exception is raised, when an entity is looked up by name, but doesn't exist in the searched library.
1524 Message: :pycode:`f"Entity '{entityName}' not found in library '{libraryName}'."`
1525 """
1527 def __init__(self, entityName: str, libraryName: str) -> None:
1528 """
1529 Initializes the exception message based on the given entity name and library name.
1531 :param entityName: The name of the entity, which was not found.
1532 :param libraryName: The name of the searched library.
1533 """
1534 super().__init__(f"Entity '{entityName}' not found in library '{libraryName}'.")
1536 self._designUnitName = entityName
1537 self._libraryName = libraryName
1540@export
1541class PackageNotFoundError(VHDLModelException, DesignUnitNotFoundError):
1542 """
1543 This exception is raised, when a package is looked up by name, but doesn't exist in the searched library.
1545 Message: :pycode:`f"Package '{packageName}' not found in library '{libraryName}'."`
1546 """
1548 def __init__(self, packageName: str, libraryName: str) -> None:
1549 """
1550 Initializes the exception message based on the given package name and library name.
1552 :param packageName: The name of the package, which was not found.
1553 :param libraryName: The name of the searched library.
1554 """
1555 super().__init__(f"Package '{packageName}' not found in library '{libraryName}'.")
1557 self._designUnitName = packageName
1558 self._libraryName = libraryName
1561@export
1562class ConfigurationNotFoundError(VHDLModelException, DesignUnitNotFoundError):
1563 """
1564 This exception is raised, when a configuration is looked up by name, but doesn't exist in the searched library.
1566 Message: :pycode:`f"Configuration '{configurationName}' not found in library '{libraryName}'."`
1567 """
1569 def __init__(self, configurationName: str, libraryName: str) -> None:
1570 """
1571 Initializes the exception message based on the given configuration name and library name.
1573 :param configurationName: The name of the configuration, which was not found.
1574 :param libraryName: The name of the searched library.
1575 """
1576 super().__init__(f"Configuration '{configurationName}' not found in library '{libraryName}'.")
1578 self._designUnitName = configurationName
1579 self._libraryName = libraryName
1582@export
1583class ContextNotFoundError(VHDLModelException, DesignUnitNotFoundError):
1584 """
1585 This exception is raised, when a context is looked up by name, but doesn't exist in the searched library.
1587 Message: :pycode:`f"Context '{contextName}' not found in library '{libraryName}'."`
1588 """
1590 def __init__(self, contextName: str, libraryName: str) -> None:
1591 """
1592 Initializes the exception message based on the given context name and library name.
1594 :param contextName: The name of the context, which was not found.
1595 :param libraryName: The name of the searched library.
1596 """
1597 super().__init__(f"Context '{contextName}' not found in library '{libraryName}'.")
1599 self._designUnitName = contextName
1600 self._libraryName = libraryName
1603@export
1604class VHDLWriterError(VHDLModelException):
1605 """
1606 This exception is raised, when the VHDL writer can't write a model element as VHDL source text.
1608 The element's content has no VHDL notation, e.g. a string literal containing a control character.
1609 """
1611 _element: ModelElementUnion #: The model element the writer could not write.
1613 def __init__(self, message: str, element: ModelElementUnion) -> None:
1614 """
1615 Initializes the exception with a message and the model element that could not be written.
1617 :param message: The error message.
1618 :param element: The model element that could not be written.
1619 """
1620 super().__init__(message)
1621 self._element = element
1623 @readonly
1624 def Element(self) -> ModelElementUnion:
1625 """
1626 Read-only property to access the model element that could not be written (:attr:`_element`).
1628 :returns: The model element.
1629 """
1630 return self._element