GithubHelp home page GithubHelp logo

Comments (3)

grigi avatar grigi commented on May 12, 2024

A comprehensive error is like so:

tortoise.exceptions.FieldError: Unknown filter param 'charup'. Allowed values are ['char', 'char__contains', 'char__endswith', 'char__gt', 'char__gte', 'char__icontains', 'char__iendswith', 'char__in', 'char__isnull', 'char__istartswith', 'char__lt', 'char__lte', 'char__not', 'char__not_in', 'char__not_isnull', 'char__startswith', 'char_null', 'char_null__contains', 'char_null__endswith', 'char_null__gt', 'char_null__gte', 'char_null__icontains', 'char_null__iendswith', 'char_null__in', 'char_null__isnull', 'char_null__istartswith', 'char_null__lt', 'char_null__lte', 'char_null__not', 'char_null__not_in', 'char_null__not_isnull', 'char_null__startswith', 'id', 'id__contains', 'id__endswith', 'id__gt', 'id__gte', 'id__icontains', 'id__iendswith', 'id__in', 'id__isnull', 'id__istartswith', 'id__lt', 'id__lte', 'id__not', 'id__not_in', 'id__not_isnull', 'id__startswith']

Its a very verbose, and that is for 3 fields only... But correct...

A version showing the base fields:

tortoise.exceptions.FieldError: Unknown filter param 'charup'. Allowed base values are ['char', 'char_null', 'id']

And much shorter, but a bit of a lie, as we don't show the filters...
To be even more helpful we could show the fields filters if you use an invalid filter?
@Zeliboba5 What do you think?

I also realised that the set of eligible values contains filters that make no sense, e.g. __is_null on non-nullable fields, __contains __beginswith etc on integers? So we could reduce that set by a bit.

from tortoise-orm.

jrmi avatar jrmi commented on May 12, 2024

I was thinking more about the second option showing only base fields. "subfilters" can be added and deduced from this list by the user. I think the important thing is that the user can easily correct is code after seeing this message.

from tortoise-orm.

grigi avatar grigi commented on May 12, 2024

Thanks @jrmi For reporting on these "paper cut" level issues. 👍 It is a thing that OSS projects often suffer on.
This will be fixed for v0.10.10

from tortoise-orm.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.