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.

The Npgsql.FSharp.Tasks can be tricky, can introduce serious bugs and confusion.

See original GitHub issue

I just wanted to ask if that was possible to introduce methods with …Throwing or …OrThrow suffix, because – in my opinion – it is very common that there is nothing one can do with failed results other than give up and let the app blow.

This is my case: I have no idea what can I do with infrastructure errors like broken database connections. All I can do is to let the app crash, the system-wide infrastructure will restart it and if that happens, the operational team gets an alert, so they can figure out what is wrong with databases. There is nothing I can do within my app to solve it.

Now I can see there is a new namespace Npgsql.FSharp.Tasks which provides almost identical functions with slightly different signatures (result types are not wrapped in result anymore).

Why is it dangerous? Let’s say we have two exactly same pieces of code:

  • using Npgsql.FSharp: … |> Sql.executeNonQuery |> ignore
  • using Npgsql.FSharp.Tasks: … |> Sql.executeNonQuery |> ignore

So, when you look at that one line of code you cannot tell it you are ignoring ANY kind of errors (like database crashed) or if you are ignoring just the result of successful operation.

The meaning of the line of code changes dramatically based on open declaration in a different place of a file. In my opinion, it can lead to critical bugs in application, because it’s so easy to misuse the API.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
Zaid-Ajajcommented, Mar 14, 2021

As of v4.0 there are no longer two namespaces, just Npgsql.FSharp which what Npgsql.FSharp.Tasks previously provided but now it is the default

0reactions
ericsampsoncommented, Dec 21, 2020

Or split into two packages…

Read more comments on GitHub >

github_iconTop Results From Across the Web

Zaid-Ajaj/Npgsql.FSharp: Thin F# wrapper ...
Thin F#-friendly layer for the Npgsql data provider for PostgreSQL. For an optimal developer experience, this library is made to work with Npgsql....
Read more >
The combined power of F# and C# | ...
Writing tests is much easier and requires much less code, and bugs are much easier to track down (since you have less surface...
Read more >
After 10+ years of EF/EF Core, I can no longer justify using it.
I've been using EF for over a decade, and it just feels completely wrong every time I do. The time you save typing...
Read more >
Issues that makes DataGrip an odd tool I can't recommend ...
For PostgreSQL database I have seen issues with metadata collection. I create a foreign key. IDE uploaded incrementally the foreign key. A few ......
Read more >
Does programming in a functional programming language ...
Yes, functional programming can avoid some common pitfalls of imperative programming but that certainly doesn't mean that its a guarantee against all bugs....
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