-
Notifications
You must be signed in to change notification settings - Fork 721
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
Better error message for query utxo without oops 2 #4825
Conversation
pure (utxo, pparams, eraHistory, systemStart, stakePools) | ||
) & onLeft (throwE . AcqFailure) | ||
& onLeft (throwE . ConvenienceUnsupportedNtcVersionError) | ||
& onLeft (throwE . QueryEraMismatch) |
There was a problem hiding this comment.
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
0731f2c
to
f980e2c
Compare
There was a problem hiding this 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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be left
here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep. Fixed!
f980e2c
to
d42248c
Compare
9991222
to
0f58e07
Compare
acfa660
to
9a6bbf3
Compare
stakePools <- ExceptT $ executeQueryCardanoMode era networkId stakePoolsQuery | ||
|
||
return (utxo, pparams, eraHistory, systemStart, stakePools) | ||
( lift $ executeLocalStateQueryExpr localNodeConnInfo Nothing $ runExceptT $ runExceptT $ do |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
a86c929
to
5bb8cf0
Compare
5bb8cf0
to
3205ae9
Compare
3205ae9
to
ad13aa2
Compare
stakePools <- ExceptT $ executeQueryCardanoMode era networkId stakePoolsQuery | ||
|
||
return (utxo, pparams, eraHistory, systemStart, stakePools) | ||
( lift $ executeLocalStateQueryExpr localNodeConnInfo Nothing $ runExceptT $ runExceptT $ do |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Error handling.
ad13aa2
to
f97d75b
Compare
Once this is merged, we no longer need
executeQueryCardanoMode
as it is no longer used anywhere.A subsequent PR will delete this function.