Jira (PUP-11127) In TypeMismatch_describer.rb I have suggested changes for more user friendly type error messages

3 views
Skip to first unread message

Arthur Lawson (Jira)

unread,
Jun 24, 2021, 7:15:02 PM6/24/21
to puppe...@googlegroups.com
Arthur Lawson created an issue
 
Puppet / Improvement PUP-11127
In TypeMismatch_describer.rb I have suggested changes for more user friendly type error messages
Issue Type: Improvement Improvement
Assignee: Arthur Lawson
Created: 2021/06/24 4:14 PM
Priority: Normal Normal
Reporter: Arthur Lawson

In Bolt ticket ([2853|https://github.com/puppetlabs/bolt/issues/2853] ) a user reported errors being unreadable when passing incorrect type to a plan function. This was especially noticeable with functions with optional arguments.

I traced the primary issue to be in the type_mismatch_describer.rb file. In the message method, there is a check for whether to print the fully detailed message (vs the short_name). Previously, if the expected value and actual value evaluated to being the same class, the detailed description would always print. 

To get shorter messages for this use case, I added a few checks to differentiate between 'Target' and 'ResultType' objects which were previously evaluating to equal classes as PObjects. As of today, the primary concern with the proposed changes is whether they effect use cases where the long message is the expected/wanted behavior.

 

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v8.13.2#813002-sha1:c495a97)
Atlassian logo

Ciprian Badescu (Jira)

unread,
Jun 29, 2021, 10:55:02 AM6/29/21
to puppe...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages