Skip to content

pick doens't produce error messages when given an invalid column name #750

Closed

Description

@boxed
> mkdir pick-test
> cd pick-test/
> touch foo.txt

> ls | pick invalid1 invalid2
━━━━━━━━━━┯━━━━━━━━━━
 invalid1 │ invalid2 
──────────┼──────────
          │  
━━━━━━━━━━┷━━━━━━━━━━

This seems wrong. An error message seems much more reasonable.

Activity

  1. andrasio commented on Oct 31, 2019

    @andrasio
    Member

    @boxed Thanks for reporting it!

  2. added
    category:bug
    good first issue
    on Oct 31, 2019
  3. andrasio commented on Nov 2, 2019

    @andrasio
    Member
  4. drmason13 commented on Nov 7, 2019

    @drmason13
    Contributor

    I'd like to take a crack at this, if I may? Fair warning though, I'm new to this code base :)

    At the moment pick sees "Nothing" as a completely valid response every time it runs select_fields, which is why the table with empty rows gets printed.

    I'm struggling to see where to add the error checking code.
    As far as I can see pick calls select_fields() which returns an InputStream.
    My difficulty is that select_fields doesn't return a Result, and an InputStream is, on the surface, difficult to inspect.

    Inside select_fields() when matching None, a Primitive::Nothing is used by way of Value::nothing(). This might be the place to try and return errors? Err("Nothing selected") or thereabouts :)

    There may be a reason a Primitive::Nothing is returned by select_fields(), but if everything that should allow a Primitive::Nothing from select_fields is able to match the Err and opt to return Primitive::Nothing themselves then we'd be good, if that's not too burdensome!

  5. boxed commented on Nov 19, 2019

    @boxed
    Author

    Was this fixed?

  6. andrasio commented on Nov 19, 2019

    @andrasio
    Member

    @boxed Not yet. We are tracking it from #900 now to avoid having so many open issues.

  7. boxed commented on Nov 19, 2019

    @boxed
    Author

    Now you're just making me confused! :)

  8. andrasio commented on Nov 19, 2019

    @andrasio
    Member

    @boxed Heh, we decided to reopen them and track them in the meta-issue.

  9. boxed commented on Jan 7, 2020

    @boxed
    Author

    🎉

  10. added a commit that references this issue on Feb 7, 2022
  11. added a commit that references this issue on Feb 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    category:buggood first issue

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions