Title: Improve error handling to allow users to make a decision on the type of error · Issue #331 · EntityGraphQL/EntityGraphQL · GitHub
Open Graph Title: Improve error handling to allow users to make a decision on the type of error · Issue #331 · EntityGraphQL/EntityGraphQL
X Title: Improve error handling to allow users to make a decision on the type of error · Issue #331 · EntityGraphQL/EntityGraphQL
Description: I want to handle some of my own exceptions, but I can't do it yet, it seems like the system's try-catch feature is preventing it. I found it in the source code private async Task
Open Graph Description: I want to handle some of my own exceptions, but I can't do it yet, it seems like the system's try-catch feature is preventing it. I found it in the source code private async Task
X Description: I want to handle some of my own exceptions, but I can't do it yet, it seems like the system's try-catch feature is preventing it. I found it in the source code private async Task<QueryRe...
Opengraph URL: https://github.com/EntityGraphQL/EntityGraphQL/issues/331
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Improve error handling to allow users to make a decision on the type of error","articleBody":"I want to handle some of my own exceptions, but I can't do it yet, it seems like the system's try-catch feature is preventing it.\r\nI found it in the source code\r\n```\r\n private async Task\u003cQueryResult\u003e DoExecuteRequestAsync(QueryRequest gql, TContextType? overwriteContext, IServiceProvider? serviceProvider, ClaimsPrincipal? user, ExecutionOptions? options)\r\n {\r\n try\r\n {\r\n if (options == null)\r\n {\r\n options = new ExecutionOptions();\r\n }\r\n\r\n GraphQLDocument graphQLDocument = null;\r\n if (options!.EnablePersistedQueries)\r\n {\r\n PersistedQueryExtension persistedQueryExtension = (PersistedQueryExtension)ExpressionUtil.ChangeType(gql.Extensions.GetValueOrDefault(\"persistedQuery\"), typeof(PersistedQueryExtension), null);\r\n if (persistedQueryExtension != null \u0026\u0026 persistedQueryExtension.Version != 1)\r\n {\r\n throw new EntityGraphQLExecutionException(\"PersistedQueryNotSupported\");\r\n }\r\n\r\n string text = persistedQueryExtension?.Sha256Hash;\r\n if (text == null \u0026\u0026 gql.Query == null)\r\n {\r\n throw new EntityGraphQLExecutionException(\"Please provide a persisted query hash or a query string\");\r\n }\r\n\r\n if (text != null)\r\n {\r\n graphQLDocument = queryCache.GetCompiledQueryWithHash(text);\r\n if (graphQLDocument == null \u0026\u0026 gql.Query == null)\r\n {\r\n throw new EntityGraphQLExecutionException(\"PersistedQueryNotFound\");\r\n }\r\n\r\n if (graphQLDocument == null)\r\n {\r\n graphQLDocument = graphQLCompiler.Compile(gql, new QueryRequestContext(AuthorizationService, user));\r\n queryCache.AddCompiledQuery(text, graphQLDocument);\r\n }\r\n }\r\n else if (graphQLDocument == null)\r\n {\r\n graphQLDocument = ((!options!.EnableQueryCache) ? graphQLCompiler.Compile(gql, new QueryRequestContext(AuthorizationService, user)) : CompileQueryWithCache(gql, user));\r\n }\r\n }\r\n else if (options!.EnableQueryCache)\r\n {\r\n graphQLDocument = CompileQueryWithCache(gql, user);\r\n }\r\n else\r\n {\r\n if (gql.Query == null)\r\n {\r\n if (((PersistedQueryExtension)ExpressionUtil.ChangeType(gql.Extensions.GetValueOrDefault(\"persistedQuery\"), typeof(PersistedQueryExtension), null))?.Sha256Hash != null)\r\n {\r\n throw new EntityGraphQLExecutionException(\"PersistedQueryNotSupported\");\r\n }\r\n\r\n throw new ArgumentNullException(\"Query\", \"Query must be set unless you are using persisted queries\");\r\n }\r\n\r\n graphQLDocument = graphQLCompiler.Compile(gql, new QueryRequestContext(AuthorizationService, user));\r\n }\r\n\r\n return await graphQLDocument.ExecuteQueryAsync(overwriteContext, serviceProvider, gql.Variables, gql.OperationName, options);\r\n }\r\n catch (Exception exception)\r\n {\r\n return HandleException(exception);\r\n }\r\n }\r\n````","author":{"url":"https://github.com/soilidokay","@type":"Person","name":"soilidokay"},"datePublished":"2023-11-29T08:41:01.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":5},"url":"https://github.com/331/EntityGraphQL/issues/331"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:1dde2aa2-f3bd-adaf-511e-e32cc3c5ff36 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 897A:18AA88:19A3CB7:246E651:6978D670 |
| html-safe-nonce | cab9f491d81c440a7911ac359efe90b5a5330c66cc3091942f6131ce74b84ba9 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4OTdBOjE4QUE4ODoxOUEzQ0I3OjI0NkU2NTE6Njk3OEQ2NzAiLCJ2aXNpdG9yX2lkIjoiNDIxMzAxNjI4OTUxNDkzNTkyMCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | ac9068bf9bf36a4eff78883dc0b26d389cd54866c9d09db606e9c8cbd5a18a8c |
| hovercard-subject-tag | issue:2016085146 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/EntityGraphQL/EntityGraphQL/331/issue_layout |
| twitter:image | https://opengraph.githubassets.com/ce5d51d5ad336430e8fe2e3921fda73d837e78aed92227ee1a7eb4666c564103/EntityGraphQL/EntityGraphQL/issues/331 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/ce5d51d5ad336430e8fe2e3921fda73d837e78aed92227ee1a7eb4666c564103/EntityGraphQL/EntityGraphQL/issues/331 |
| og:image:alt | I want to handle some of my own exceptions, but I can't do it yet, it seems like the system's try-catch feature is preventing it. I found it in the source code private async Task |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | soilidokay |
| hostname | github.com |
| expected-hostname | github.com |
| None | 8a71ca1f7ab5436216e1df86f398ef7a51ed3152c90e3f7332fc70cf97fcb9d6 |
| turbo-cache-control | no-preview |
| go-import | github.com/EntityGraphQL/EntityGraphQL git https://github.com/EntityGraphQL/EntityGraphQL.git |
| octolytics-dimension-user_id | 87887288 |
| octolytics-dimension-user_login | EntityGraphQL |
| octolytics-dimension-repository_id | 38514759 |
| octolytics-dimension-repository_nwo | EntityGraphQL/EntityGraphQL |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 38514759 |
| octolytics-dimension-repository_network_root_nwo | EntityGraphQL/EntityGraphQL |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | eaed570eead52a9920afef75dc3eb6d826fdc5ef |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width