question-mark
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.

You attempted to access the Error property for a successful result. A successful result has no Error.

See original GitHub issue

I have receiving You attempted to access the Error property for a successful result. A successful result has no Error. error when I send value from service to controller. I receive it on service level.

public async Task<CSharpFunctionalExtensions.Result<QuestionDto>> GetQuestionWithElementsById2(int id)
    {
        var questionWithElements = await _tenantUnitOfWork.QuestionRepository.GetQuestionWithElementsById(id);

        var questionsWithElementsDto = _mapper.Map<QuestionDto>(questionWithElements);

        return Result.Success<QuestionDto>(questionsWithElementsDto);
    }

image

Issue Analytics

  • State:open
  • Created 5 months ago
  • Comments:8

github_iconTop GitHub Comments

1reaction
hankovichcommented, Apr 14, 2023

The stacktrace shows that this error was thrown during response formatting, i.e. result was returned not only from service to controller, but also it was returned from controller itself.

If you want to return results from controller, you may use this extension to add corresponding converters for System.Text.Json.

0reactions
namigmustafacommented, Apr 14, 2023

huge thanks

Read more comments on GitHub >

github_iconTop Results From Across the Web

You attempted to access the Value property for a failed ...
ResultSuccessException : You attempted to access the Error property for a successful result. A successful result has no Error.
Read more >
Functional C#: Handling failures, input errors
As your Result type is open it means you always can just access the Value directly and you never have to check the...
Read more >
Error: ValueFactory attempted to access the Value property ...
Value . This has two effects. First, it hides the original exception, overwriting it with InvalidOperationException , which makes the underlying ...
Read more >
Error (The changes you requested to the table were not ...
Describes an issue in which you receive a (The changes you requested to the table were not successful) message when you insert a...
Read more >
Handling operation errors - Apollo GraphQL Docs
Apollo Client helps you handle these errors according to their type, enabling you to show appropriate information to the user when an error...
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 Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found