graphql-engine/server
Samir Talwar eab4f75212 An ErrorMessage type, to encapsulate.
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
2022-07-18 20:27:06 +00:00
..
bench-wrk server/tests-py: Reduce the number of locations we check the status code. 2022-07-05 18:01:07 +00:00
benchmarks ci: hide old benchmark reports for PRs with many comments 2022-02-24 20:09:17 +00:00
documentation server/postgres: test identifier uniqueness rewrite 2022-06-17 10:44:18 +00:00
lib/aeson-ordered server: move ordered Aeson into its own package 2022-07-07 15:55:52 +00:00
src-dc-api Add support for custom comparison operators 2022-07-15 03:29:06 +00:00
src-emit-metadata-openapi server: initial set of DTO types for metadata 2022-06-27 16:33:31 +00:00
src-exec Monomorphize Some Hge Options 2022-07-01 03:40:46 +00:00
src-lib An ErrorMessage type, to encapsulate. 2022-07-18 20:27:06 +00:00
src-rsr ci: tag release v2.9.0-beta.2 2022-07-13 13:03:03 +00:00
src-test An ErrorMessage type, to encapsulate. 2022-07-18 20:27:06 +00:00
tests-dc-api Support composite primary keys for Data Connector [GDW-127] 2022-07-01 12:21:17 +00:00
tests-hspec An ErrorMessage type, to encapsulate. 2022-07-18 20:27:06 +00:00
tests-py An ErrorMessage type, to encapsulate. 2022-07-18 20:27:06 +00:00
.dockerignore update packages (#251) 2018-08-08 13:10:13 +05:30
.gitignore server: Clean up Cabal project files 2022-04-07 07:16:12 +00:00
commit_diff.txt Rewrite GraphQL schema generation and query parsing (close #2801) (#4111) 2020-08-21 12:27:01 -05:00
COMPILING-ON-MACOS.md tooling: Opt-in shared tooling 2022-06-16 17:12:35 +00:00
CONTRIBUTING.md server: update docs for updating cabal.project.freeze 2022-07-07 15:59:26 +00:00
graphql-engine.cabal An ErrorMessage type, to encapsulate. 2022-07-18 20:27:06 +00:00
Makefile ci: misc. cleanup, naming 2022-01-03 06:26:39 +00:00
STYLE.md Nix: Use nixpkgs-fmt to format everything. 2022-06-20 13:02:45 +00:00
testing-guidelines.md server: testing guidelines 2022-03-08 09:53:27 +00:00
troubleshooting.md Create troubleshooting.md 2022-05-30 09:18:44 +00:00