Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better error message for query utxo without oops 2 #4825

Conversation

newhoggy
Copy link
Contributor

@newhoggy newhoggy commented Jan 21, 2023

Once this is merged, we no longer need executeQueryCardanoMode as it is no longer used anywhere.

A subsequent PR will delete this function.

pure (utxo, pparams, eraHistory, systemStart, stakePools)
) & onLeft (throwE . AcqFailure)
& onLeft (throwE . ConvenienceUnsupportedNtcVersionError)
& onLeft (throwE . QueryEraMismatch)
Copy link
Contributor Author

@newhoggy newhoggy Jan 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some queries like QueryUTxO, QueryProtocolParameters and QueryStakePools return their own errors (in this case EraMismatch) so needs to be handled with an extra ExceptT stack.

Unfortunately this means that if a query is added to an expression that requires an extra layer in the stack, all queries in the query expression will need to be changed to accomodate that extra layer.

This is a problem that does not exist when using oops: https://github.com/input-output-hk/cardano-node/pull/4777/files#r1084878188

@newhoggy newhoggy marked this pull request as ready for review January 24, 2023 06:47
@newhoggy newhoggy force-pushed the newhoggy/better-error-message-for-query-utxo-without-oops-2 branch from 0731f2c to f980e2c Compare January 24, 2023 06:48
Copy link
Contributor

@Jimbo4350 Jimbo4350 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One minor change

systemStart <- ExceptT $ fmap Right $ ExceptT $ queryExpr systemStartQuery
stakePools <- ExceptT $ ExceptT $ queryExpr stakePoolsQuery
pure (utxo, pparams, eraHistory, systemStart, stakePools)
) & onLeft (throwE . AcqFailure)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be left here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep. Fixed!

@newhoggy newhoggy force-pushed the newhoggy/better-error-message-for-query-utxo-without-oops-2 branch from f980e2c to d42248c Compare January 25, 2023 08:18
@newhoggy newhoggy requested a review from Jimbo4350 January 25, 2023 08:18
@newhoggy newhoggy force-pushed the newhoggy/better-error-message-for-query-utxo-without-oops-2 branch 2 times, most recently from 9991222 to 0f58e07 Compare February 3, 2023 17:23
@newhoggy newhoggy force-pushed the newhoggy/better-error-message-for-query-utxo-without-oops-2 branch 4 times, most recently from acfa660 to 9a6bbf3 Compare February 13, 2023 06:24
stakePools <- ExceptT $ executeQueryCardanoMode era networkId stakePoolsQuery

return (utxo, pparams, eraHistory, systemStart, stakePools)
( lift $ executeLocalStateQueryExpr localNodeConnInfo Nothing $ runExceptT $ runExceptT $ do
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we hold off until oops is integrated? This is a decrease in readability imo.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still think this is a decrease in readability. I'll start a discussion on slack today.

@newhoggy newhoggy requested review from Jimbo4350 March 3, 2023 14:04
@newhoggy newhoggy force-pushed the newhoggy/better-error-message-for-query-utxo-without-oops-2 branch 2 times, most recently from a86c929 to 5bb8cf0 Compare March 10, 2023 04:44
@newhoggy newhoggy requested review from a team, coot, deepfire, jutaro, mgmeier and fmaste as code owners March 10, 2023 04:44
@newhoggy newhoggy requested review from cleverca22 and a team as code owners March 10, 2023 04:44
@newhoggy newhoggy force-pushed the newhoggy/better-error-message-for-query-utxo-without-oops-2 branch from 5bb8cf0 to 3205ae9 Compare March 10, 2023 23:55
@newhoggy newhoggy force-pushed the newhoggy/better-error-message-for-query-utxo-without-oops-2 branch from 3205ae9 to ad13aa2 Compare March 29, 2023 01:32
stakePools <- ExceptT $ executeQueryCardanoMode era networkId stakePoolsQuery

return (utxo, pparams, eraHistory, systemStart, stakePools)
( lift $ executeLocalStateQueryExpr localNodeConnInfo Nothing $ runExceptT $ runExceptT $ do
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still think this is a decrease in readability. I'll start a discussion on slack today.

pparams <- ExceptT $ ExceptT $ queryExpr pparamsQuery
eraHistory <- ExceptT $ fmap Right $ ExceptT $ queryExpr eraHistoryQuery
systemStart <- ExceptT $ fmap Right $ ExceptT $ queryExpr systemStartQuery
stakePools <- ExceptT $ ExceptT $ queryExpr stakePoolsQuery
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error handling.

@newhoggy newhoggy force-pushed the newhoggy/better-error-message-for-query-utxo-without-oops-2 branch from ad13aa2 to f97d75b Compare May 11, 2023 14:03
@newhoggy newhoggy closed this Dec 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants