Issue #22365 has been updated by Henrik Lindberg.

Status changed from Needs Decision to Accepted

I will need to look into in more detail what is going on - but yes, at one 
level errors are "runtime errors" (like division with zero) and there needs to 
be a general rescue. 
For all such problems it is naturally not possible to attach more detailed 
errors. (It would need to lookup which expression object was being transformed, 
which would be quite hard).

In the transformer, it should be very much doable however since it has the 
Parsed Pops model (the "future AST"). While it is good to provide the location 
information for the errors in transformation, the errors should really have 
been caught by validation (since it is doing the job of figuring out what is 
wrong and giving the "better error messages". In the transformer it is more 
"convert it-or fail" with the exception of a few minor things
that are checked. We don't want the transformer to redo all the work done in 
the validator / checker.

Going forward, when there is a new evaluator, there will be no transformation 
step; only the validation/check step and then evaluation (which naturally can 
trigger runtime errors.

I guess I am trying to say that it is less meaningful to spend lots of time on 
the transformer while I do agree that it is of value to pinpoint the source 
that triggered the problem.

You are also right about the SourcePosAdapter, it is a mechanism that allows 
attaching a source position to objects. Almost all model object (the AST) that 
have a textual representation have one such adapter, there are a few exceptions 
and it is needed to search towards the root of the tree to find the enclosing 
expression's position - the `find_adapter` does that.

It is probably not that hard nor time consuming to do something general that is 
good enough. (And add more validation that does an even better job on a "case 
by case basis" ). I am thinking just rescue transformation errors and pick up 
which model object it was operating on...


----------------------------------------
Bug #22365: All errors created by future parser ast_transformer lack line 
numbers
https://projects.puppetlabs.com/issues/22365#change-97429

* Author: Erik Dalén
* Status: Accepted
* Priority: Normal
* Assignee: Henrik Lindberg
* Category: parser
* Target version: 
* Affected Puppet version: 3.2.4
* Keywords: future_parser
* Branch: 
----------------------------------------
Errors created by the ast transformer in the future parser have the wrong type, 
so they lack line numbers. An example is:

    puppet apply --parser=future -e 'File<||> ? {default=>foo}'


-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://projects.puppetlabs.com/my/account

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/puppet-bugs.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to