Skip Menu |

This queue is for tickets about the Type-Tiny CPAN distribution.

Report information
The Basics
Id: 87999
Status: resolved
Priority: 0/
Queue: Type-Tiny

People
Owner: perl [...] toby.ink
Requestors: TIMB [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: (no value)
Fixed in: (no value)



Subject: Make constraint failure errors look less like data dumps
With complex types the error message on constraint failure also gets complex: {"featured_listing_id" => 0,"inflate_via" => "pg","inflate_with" => {"with_age" => 1,"with_formatted_attributes" => "list","with_mls_board" => 'FaceBookApp::Model::Corp::MlsBoard=HASH(0xc3c2908)',"with_status" => '14',"with_type" => '4'},"page_number" => 1,"rows_per_page" => 10,"search_criteria" => bless( {"mls_board_id" => 70,"search_images_count_min" => 1,"search_mls_area_ids" => 'ARRAY(0xa478c00)',"search_mls_boards_mls_type_ids" => 'ARRAY(0xa4794a0)'}, 'TigerLead::MLS::ListingSearch::Criteria' ),"search_via" => "es","sort_order" => "price"} did not pass type constraint "Dict[inflate_via=>Maybe[StrMatch[(?-xism:^(?:es|pg)$)]],inflate_with=>Maybe[HashRef],page_number=>PageNumberType,rows_per_page=>Int2_not_negative,search_criteria=>Ref,search_via=>Maybe[StrMatch[(?-xism:^(?:es|pg)$)]],sort_order=>Str]" (in $SLURPY) at foo.pm line 95. My issue is that the key "did not pass type constraint" text is 'lost' in all those details. The details are very helpful so I don't want to loose them, but the error message looks like a simple debug data dump. I would like to find a way to make it look less like a debug data dump. I suggest simply adding the prefix "The value " to the message: The value {"featured_listing_id" => 0,"inflate_via" => "pg","inflate_with" => {"with_age" => 1,"with_formatted_attributes" => "list","with_mls_board" => 'FaceBookApp::Model::Corp::MlsBoard=HASH(0xc3c2908)',"with_status" => '14',"with_type" => '4'},"page_number" => 1,"rows_per_page" => 10,"search_criteria" => bless( {"mls_board_id" => 70,"search_images_count_min" => 1,"search_mls_area_ids" => 'ARRAY(0xa478c00)',"search_mls_boards_mls_type_ids" => 'ARRAY(0xa4794a0)'}, 'TigerLead::MLS::ListingSearch::Criteria' ),"search_via" => "es","sort_order" => "price"} did not pass type constraint "Dict[inflate_via=>Maybe[StrMatch[(?-xism:^(?:es|pg)$)]],inflate_with=>Maybe[HashRef],page_number=>PageNumberType,rows_per_page=>Int2_not_negative,search_criteria=>Ref,search_via=>Maybe[StrMatch[(?-xism:^(?:es|pg)$)]],sort_order=>Str]" (in $SLURPY) at foo.pm line 95. that simple change immediately clues the reader that there's a sentence here so they know to make the effort to read it.
On 2013-08-21T13:22:55+01:00, TIMB wrote: Show quoted text
> With complex types the error message on constraint failure also gets > complex
True. FWIW, non-references already get "Value" put in front of them. I'll need to think carefully about this one because IIRC there are tests in various CPAN modules that are not maintained by me that check exceptions thrown with regexps. But I will certainly do *something* about it.
Show quoted text
> I'll need to think carefully about this one because IIRC there are > tests in various CPAN modules that are not maintained by me that check > exceptions thrown with regexps.
Actually, they seem to only be testing non-references, so there's scope to change the error for references. I've checked something into the repo, and should have a dev release out this evening. Hoping for another stable release early next week.
Fixed in 0.023_02; will close ticket after next stable release.
Fixed in 0.024.