mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-17 20:41:49 +03:00
eab4f75212
This introduces an `ErrorMessage` newtype which wraps `Text` in a manner which is designed to be easy to construct, and difficult to deconstruct. It provides functionality similar to `Data.Text.Extended`, but designed _only_ for error messages. Error messages are constructed through `fromString`, concatenation, or the `toErrorValue` function, which is designed to be overridden for all meaningful domain types that might show up in an error message. Notably, there are not and should never be instances of `ToErrorValue` for `String`, `Text`, `Int`, etc. This is so that we correctly represent the value in a way that is specific to its type. For example, all `Name` values (from the _graphql-parser-hs_ library) are single-quoted now; no exceptions. I have mostly had to add `instance ToErrorValue` for various backend types (and also add newtypes where necessary). Some of these are not strictly necessary for this changeset, as I had bigger aspirations when I started. These aspirations have been tempered by trying and failing twice. As such, in this changeset, I have started by introducing this type to the `parseError` and `parseErrorWith` functions. In the future, I would like to extend this to the `QErr` record and the various `throwError` functions, but this is a much larger task and should probably be done in stages. For now, `toErrorMessage` and `fromErrorMessage` are provided for conversion to and from `Text`, but the intent is to stop exporting these once all error messages are converted to the new type. PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5018 GitOrigin-RevId: 84b37e238992e4312255a87ca44f41af65e2d89a |
||
---|---|---|
.. | ||
inherited_roles | ||
inherited_roles_mssql | ||
anonymous_can_only_get_published_articles_v1alpha1.yaml | ||
anonymous_can_only_get_published_articles.yaml | ||
artist_search_tracks_aggregate.yaml | ||
artist_search_tracks.yaml | ||
artist_select_query_Track_fail.yaml | ||
artist_select_query_Track.yaml | ||
in_and_nin.yaml | ||
iregex.yaml | ||
jsonb_has_all.yaml | ||
jsonb_has_any.yaml | ||
reader_author.yaml | ||
select_articles_without_required_headers.yaml | ||
setup.yaml | ||
staff_passed_students.yaml | ||
teardown.yaml | ||
tutor_get_students_session.yaml | ||
tutor_get_students.yaml | ||
user_can_query_geometry_values_filter_session_vars.yaml | ||
user_can_query_geometry_values_filter.yaml | ||
user_can_query_jsonb_values_filter_session_vars.yaml | ||
user_can_query_jsonb_values_filter.yaml | ||
user_can_query_other_users_published_articles.yaml | ||
user_cannot_access_remarks_col.yaml | ||
user_query_auction.yaml | ||
user_select_query_article_author.yaml | ||
user_select_query_unpublished_articles.yaml | ||
user_should_not_be_able_to_access_books_by_pk.yaml |