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 |
||
---|---|---|
.. | ||
author_with_permission_mssql.yaml | ||
nested_select_with_foreign_key_alter.yaml | ||
nodes_aggregates_conditions_mssql.yaml | ||
nodes_aggregates_mssql.yaml | ||
schema_setup_citus.yaml | ||
schema_setup_mssql.yaml | ||
schema_teardown_citus.yaml | ||
schema_teardown_mssql.yaml | ||
select_multiple_columns_arr_fkey.yaml | ||
select_multiple_columns_obj_fkey.yaml | ||
select_placeholder_err.yaml | ||
select_query_author_v1alpha1.yaml | ||
select_query_batching_with_mutation.yaml | ||
select_query_batching_with_one_error.yaml | ||
select_query_batching.yaml | ||
select_query_fragment_cycles.yaml | ||
select_query_fragment_with_variable.yaml | ||
select_query_invalid_escape_sequence.yaml | ||
select_query_nested_fragment.yaml | ||
select_query_person_citext.yaml | ||
select_query_test_types_mssql.yaml | ||
select_query_test_types_postgres.yaml | ||
select_query_top_level_fragment.yaml | ||
select_query_user_col_change_mssql.yaml | ||
select_query_user_col_change_postgres.yaml | ||
select_query_user_mssql.yaml | ||
select_query_user_postgres.yaml | ||
setup_citus.yaml | ||
setup_invalid_fkey_relationship.yaml | ||
setup_mssql.yaml | ||
setup.yaml | ||
teardown_citus.yaml | ||
teardown_mssql.yaml | ||
teardown.yaml |