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.

[Question]: Why not use Result everywhere?

See original GitHub issue

@stemmlerjs hope you are well!

I would like to know why in repos you have chosen to try catch and throw Errors.

Yet in most other places you are returning a Result.fail or Result.ok.

Thanks!

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
imcyeecommented, Apr 22, 2022

Because repo implementation is using library that is created by others.

When-to-throw-errors-purposefully B: When we encounter errors that we don’t expect or know how to deal with. These are errors that really mess up what we were trying to do and can be caused by an infinite possibility of things that we didn’t expect or assume would happen:

database connectivity issues
code typos
null pointer errors (sometimes)
out of memory
1reaction
imcyeecommented, Apr 22, 2022

I think you definitely can implement it with Result class. Don’t see any problem with it. Instead of {succeeded:boolean} you will have Result.ok/fail(), from what I learned from his blog, I think this one you have choice to choose between simple json and Result class.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Ask HN: Why do search functions everywhere not return what I ...
It's driving me nuts. All over the web, search functions don't actually return the word you searched for. They seem to all do...
Read more >
c# - Await on a completed task same as task.Result?
Parallel task code can use Result and Wait . Note that (1) is by far the common case, hence my tendency to use...
Read more >
Avoiding simple mistakes in async await - Anthony Steele
Use await not .Result to get the result of a task. Avoid becoming synchronous again wherever possible. Avoid Task.Run . Avoid async void...
Read more >
Long Story Short: Async/Await Best Practices in .NET - Medium
The only time we truly want to await is when we do something with the result of the async task in the continuation...
Read more >
988 Frequently Asked Questions - SAMHSA
FAQs About 988 Basics · What is 988? · Is 988 available for substance use crisis? · Does the 1-800-273-8255 number still work?...
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