mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-18 04:51:35 +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 |
||
---|---|---|
.. | ||
remote_joins | ||
create_user_fail.yaml | ||
create_user_relationship_fail.yaml | ||
create_user_relationship.yaml | ||
create_user_success.yaml | ||
create_users_fail.yaml | ||
create_users_success.yaml | ||
expecting_array_response_got_null.yaml | ||
expecting_array_response.yaml | ||
expecting_custom_scalar_array_response_success.yaml | ||
expecting_custom_scalar_response_success.yaml | ||
expecting_jsonb_response_success.yaml | ||
expecting_object_response_got_null.yaml | ||
expecting_object_response_got_scalar.yaml | ||
expecting_object_response_with_nested_null.yaml | ||
expecting_object_response.yaml | ||
expecting_scalar_response_got_object.yaml | ||
extensions_code_both_codes.yaml | ||
extensions_code_nothing.yaml | ||
extensions_code_only_empty_extensions.yaml | ||
extensions_code_only_extensions_code.yaml | ||
extensions_code_toplevel_empty_extensions.yaml | ||
extensions_code_toplevel_no_extensions.yaml | ||
get_null_field_expecting_non_nullable_field_array.yaml | ||
get_scalar_action_output_type_success.yaml | ||
get_string_scalar_array_action_output_type_expecting_number_array.yaml | ||
get_string_scalar_array_action_output_type_success.yaml | ||
get_user_by_email_fail.yaml | ||
get_user_by_email_nested_join_success.yaml | ||
get_user_by_email_nested_success.yaml | ||
get_user_by_email_success.yaml | ||
get_users_by_email_success.yaml | ||
mirror_action_no_field.yaml | ||
mirror_action_not_null.yaml | ||
mirror_action_success.yaml | ||
mirror_action_transformed_output_success.yaml | ||
mirror_action_transformed_success.yaml | ||
mirror_action_unexpected_field.yaml | ||
null_response.yaml | ||
object_response_action_transformed_output.yaml | ||
query_action_recursive_output.yaml | ||
query_action_relationship_with_permission.yaml | ||
results_list_transformed_output_success.yaml | ||
scalar_response_action_transformed_output.yaml | ||
schema_setup.yaml | ||
schema_teardown.yaml | ||
values_teardown.yaml |