Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Development and production error messages

See original GitHub issue

When a query in an added field fails, EntityGraphQL helpfully provides a GraphQL response that contains the error. However, the error message sometimes doesn’t contain the message from the inner exception. For example, if Entity Framework Core is confirmed to throw on warnings in OnConfiguring, like this

optionsBuilder.ConfigureWarnings(b => b.Default(WarningBehavior.Throw));

EntityGraphQL doesn’t show the actual error. For example, for a warning about client-side execution being required, the output is just:

    "errors": [
            "message": "Field 'customers' - Exception has been thrown by the target of an invocation."

In development (per IWebHostEnvironment), the underlying cause should be shown. Conversely, for security in production, the error should show the same message that an ASP.NET Core API controller shows in production, with the exception message not provided.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

breyedcommented, Aug 22, 2022

One approach would be a property on SchemaProvider:

/// <summary>
/// Gets or sets whether to expose the <see cref="Exception.Message"/> property of exceptions thrown
/// from application code called by EntityGraphQL and caught by EntityGraphQL.
/// If false, the error message "Internal server error" will be used. If null (the default),
/// exception messages are exposed if the ASP.NET Core `IWebHostEnvironment` service
/// is available and is set to `Developmenet`.
/// </summary>
public bool? ExposeExceptions { get; set; }
lukemurraycommented, Oct 5, 2022

#262 introduces the ability to control this

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error Handling: Making Production Ready Code
This is why standardized error messages are necessary to implement if you want your application to be production ready.
Read more >
General error handling rules | Technical Writing
Before we get to the fun part of the course—wording error messages—let's discuss a few general error handling rules.
Read more >
Error Messages: Examples, Best Practices & Common ...
4 common mistakes with error messages · 1. Ambiguity · 2. Condescending language/blaming the user · 3. Poor placement of error messages ·...
Read more >
Fixing what's broken: How to improve your in-product error ...
Error messages are the backbone of any product. They provide guidance, communicate the outcome of an action, and help users troubleshoot.
Read more >
Error-Message Guidelines
Design effective error messages by ensuring they are highly visible, provide constructive communication, and respect user effort.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found