mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-23 15:32:27 +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 |
||
---|---|---|
.. | ||
permissions | ||
remote_relationships | ||
validation | ||
add_remote_schema_err_missing_arg.yaml | ||
add_remote_schema_err_missing_field.yaml | ||
add_remote_schema_err_unknown_interface.yaml | ||
add_remote_schema_iface_err_wrong_arg_type.yaml | ||
add_remote_schema_with_iface_err_empty_fields_list.yaml | ||
add_remote_schema_with_iface_err_extra_non_null_arg.yaml | ||
add_remote_schema_with_iface_err_wrong_field_type.yaml | ||
add_remote_schema_with_union_err_member_type_interface.yaml | ||
add_remote_schema_with_union_err_no_member_types.yaml | ||
add_remote_schema_with_union_err_unknown_types.yaml | ||
add_remote_schema_with_union_err_wrapped_type.yaml | ||
basic_bulk_remove_add.yaml | ||
basic_query_customized.yaml | ||
basic_query_with_op_name.yaml | ||
basic_query.yaml | ||
basic_subscription_not_supported.yaml | ||
basic_timeout_query.yaml | ||
character_interface_query.yaml | ||
check_resp_headers.yaml | ||
create_conflicting_table.yaml | ||
drop_person_table.yaml | ||
drop_user_table.yaml | ||
json_scalar.yaml | ||
person_table.yaml | ||
search_union_type_query.yaml | ||
simple2_mutation.yaml | ||
simple2_query.yaml | ||
tbls_setup.yaml | ||
tbls_teardown.yaml |