mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-18 13:02:11 +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 | ||
address_permission_error.yaml | ||
article_if_matched_restricted_role_mssql.yaml | ||
article_if_matched_user_role_mssql.yaml | ||
article_on_conflict_constraint_on_user_role_error.yaml | ||
article_on_conflict_restricted_role.yaml | ||
article_on_conflict_user_role.yaml | ||
article_user_role_check_fail_mssql.yaml | ||
article_user_role_columns_fail_mssql.yaml | ||
author_on_conflict_ignore_user_role.yaml | ||
author_student_role_insert_check_bio_fail.yaml | ||
author_student_role_insert_check_bio_success.yaml | ||
author_user_role_insert_check_is_registered_fail.yaml | ||
author_user_role_insert_check_perm_success.yaml | ||
author_user_role_insert_check_user_id_fail.yaml | ||
backend_user_insert_fail.yaml | ||
backend_user_insert_invalid_bool.yaml | ||
backend_user_insert_pass.yaml | ||
backend_user_no_admin_secret_fail.yaml | ||
blog_on_conflict_update_preset.yaml | ||
column_comparison_across_tables.yaml | ||
company_user_role_on_conflict.yaml | ||
company_user_role.yaml | ||
developer_insert_has_keys_any_fail.yaml | ||
developer_insert_has_keys_any_pass.yaml | ||
insert_article_arr_sess_var_editor_allowed_user_id.yaml | ||
insert_article_arr_sess_var_editors_err_not_allowed_user_id.yaml | ||
leads_upsert_check_with_headers.yaml | ||
resident_5_modifies_resident_6_upsert.yaml | ||
resident_infant_fail.yaml | ||
resident_infant.yaml | ||
resident_on_conflict_where.yaml | ||
resident_user.yaml | ||
schema_setup_mssql.yaml | ||
schema_setup.yaml | ||
schema_teardown_mssql.yaml | ||
schema_teardown.yaml | ||
seller_insert_computer_has_keys_all_fail.yaml | ||
seller_insert_computer_has_keys_all_pass.yaml | ||
setup_mssql.yaml | ||
teardown_mssql.yaml | ||
user_article_error_unexpected_on_conflict_action.yaml | ||
user_article_on_conflict_error_missing_article_constraint.yaml | ||
user_article_unexpected_on_conflict_constraint_error.yaml | ||
user_insert_account_fail.yaml | ||
user_insert_account_success.yaml | ||
user_with_no_backend_privilege.yaml | ||
values_setup_mssql.yaml | ||
values_setup.yaml | ||
values_teardown_mssql.yaml | ||
values_teardown.yaml |