Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error messages (42) #389

Open
HolQue opened this issue Nov 14, 2024 · 1 comment
Open

Error messages (42) #389

HolQue opened this issue Nov 14, 2024 · 1 comment

Comments

@HolQue
Copy link
Collaborator

HolQue commented Nov 14, 2024

Scenario: Cyclic import

Use case (order of file imports):

jpp_examples_01.jsonp
    -> imported.jsonp
        -> imported.AA.jsonp
            -> imported.BB.jsonp
                -> imported.CC.jsonp
                    -> imported.DD.jsonp
                        -> imported.CC.jsonp (cyclic import)

For me the question is: What does a user need to know to solve the problem?

I would say: the name of the files that are involved in the cyclic import (and not necessarily the entire import flow).

Currently this is the error message:

Error: 'Cyclic imported json file '... /dynamic_imports/YYY/AA/BB/CC/imported.CC.jsonp'!
In file: '... /dynamic_imports/YYY/AA/BB/CC/DD/imported.DD.jsonp'
In file: '... /dynamic_imports/YYY/AA/BB/CC/imported.CC.jsonp'
In file: '... /dynamic_imports/YYY/AA/BB/imported.BB.jsonp'
In file: '... /dynamic_imports/YYY/AA/imported.AA.jsonp'
In file: '... /dynamic_imports/YYY/imported.jsonp'
In file: '... /jpp_examples_01.jsonp''!

This is too much. Because it's hard to find the relevant information in this list. In my opinion the user only needs to know that CC is imported by DD and previously by BB also.

An alternative error message could be:

Cyclic import error: The file '... /dynamic_imports/YYY/AA/BB/CC/imported.CC.jsonp' is imported by file '... /dynamic_imports/YYY/AA/BB/CC/DD/imported.DD.jsonp'
and by file '... /dynamic_imports/YYY/AA/BB/imported.BB.jsonp' before. But every file can only be imported once.

Another question that came into my mind: What will happen, if the JsonPreprocessor ignores all cyclic imports (silently in background)? Without throwing an error? Will this have any negative impact? Is there a certain reason to stop? Ok, a cyclic import may cause an endless loop in the code. But that can be prevented. Does it change anything if the same is imported again? If not, the JsonPreprocessor can simply ignore the import of all files that are already imported. Maybe a cyclic import is worth a warning in console only.

I am not really sure about this - but I have some doubts.

@test-fullautomation
Copy link
Owner

"But every file can only be imported once."
This is not correct.

Cyclic imports are not allowed, but the same file can be imported to different places in the configuration.
Recursion with the same file is not allowed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants