Skip to content

How can I access the errors that occur during import? #189

@WelliSolutions

Description

@WelliSolutions

When opening an AASX file, some errors are reported and printed to console, but there's no exception thrown.

Example:
an AASX file made with Package Explorer suffering from Bug 681 results in the following output.

ValueError: {https://admin-shell.io/aas/3/0}reference on line 12 is of type <class 'basyx.aas.model.base.ExternalReference'>, expected <class 'basyx.aas.model.base.ModelReference'>!
 -> Failed to construct {https://admin-shell.io/aas/3/0}reference on line 12 using _construct_submodel_reference!

Even if a ValueError is reported, I get an object_store and no exception is thrown.

Some other errors result in an exception, e.g. an AASX file made with Package Explorer suffering from Bug 666 throws a ValueError which I can catch.

My code is the same in both cases:

    def open(self, filename: str) -> model.DictObjectStore[model.Identifiable]:
        object_store: model.DictObjectStore[model.Identifiable] = model.DictObjectStore()
        file_store: aasx.DictSupplementaryFileContainer = aasx.DictSupplementaryFileContainer()
        with aasx.AASXReader(filename) as reader:
            reader.read_into(object_store=object_store, file_store=file_store)
        return object_store

How can I find out that there were errors during import?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions