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

Show errors when template resolving fails #81

Merged
merged 1 commit into from Dec 2, 2022

Conversation

MartinMystikJonas
Copy link
Collaborator

@MartinMystikJonas MartinMystikJonas commented Nov 30, 2022

  • LatteTemplateResolver return LatteTemplateResolver that can contain errors

  • TemplatePathFinder can return tempalte with null path to signal failure to evaluate expression

  • Show error when template path is expression that cannot be resolved automatically

  • Show error when no render/setFile call is found for control render

  • Show error when no template is found for presenter action

NEW

  • fixed finding variables/componets also in parents
  • fixed finding template paths also in called methods
  • fixed error when render method calls another render method
  • fixed error when same tempalte with same variables and components is resolved multiple times in different contexts

TODO:

  • expresisons containing variables are resolved as if variables are empty (maybe support replacing of variable with wildcard and look for tempaltes matching pattern?)
  • [] better context info about location of unresolved expression
  • would it be possible to interpret expression when it is assigned to variable before passing to render/setFile? (moved to Better evaluation of complex expression with variables used to construct template paths #92)
  • ignore presenter action that terminates early (redirect, sendResponse - detect call of method with never return type?)
  • two layer resolution of template path - collect calls to render and only if render has no parameter or fist parameter is null use path collected from setFile (parameter of render call takes precedence, and passing null to render is fine only when setFile is called instead) (moved to Detect parameters passed in parameter #2 or render() method #69)
  • NetteApplicationUIControl also checks render* methods in presenters - is it by mistake or intentional? If by mistake then add condition to exclude it, if intentional the do not report that tempalte cannot be resolved because it is covered by NetteApplicationUIPresenter

@MartinMystikJonas MartinMystikJonas marked this pull request as draft November 30, 2022 00:33
@MartinMystikJonas
Copy link
Collaborator Author

Do you approve this approach? If yes I will rebase nad fix tests

@lulco
Copy link
Contributor

lulco commented Dec 1, 2022

I like that we could have error when no template is found, just don't like that there is | in return type :) Template and Error are completely different interfaces. We have to check it always. Is there another way how to achieve our target?

@MartinMystikJonas
Copy link
Collaborator Author

Well another option is to have ResolverResult object that contains Templates[] and Errors[]

@lulco
Copy link
Contributor

lulco commented Dec 1, 2022

Well another option is to have ResolverResult object that contains Templates[] and Errors[]

and we will have some getters for both? It's better isn't it?

@MartinMystikJonas
Copy link
Collaborator Author

OK I will change it it would be also robust for future extension of resolvers

@MartinMystikJonas MartinMystikJonas force-pushed the unresolved-errors branch 2 times, most recently from e4ebb7f to a74cc76 Compare December 2, 2022 08:47
@MartinMystikJonas
Copy link
Collaborator Author

NEW

  • fixed finding variables/componets also in parents
  • fixed finding template paths also in called methods
  • fixed error when render method calls another render method
  • fixed error when same tempalte with same variables and components is resolved multiple times in different contexts

@MartinMystikJonas MartinMystikJonas marked this pull request as ready for review December 2, 2022 09:27
@MartinMystikJonas MartinMystikJonas merged commit 56dba25 into main Dec 2, 2022
@MartinMystikJonas MartinMystikJonas deleted the unresolved-errors branch December 2, 2022 09:33
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

Successfully merging this pull request may close these issues.

None yet

2 participants