Skip to content

Commit fb19645

Browse files
Mr-Leshiycoire1kukkok3dtscalacdependabot[bot]
authored
refactor: Update error handling in cat-gateway (#425)
* docs: Add CatalystDataGatewayRepository docs (#388) * test: Fix tests after cat-gateway update. * docs: Add `CatalystDataGatewayRepository` usage examples. * docs: Move docs from README to code comment. * test: Update `CatalystDataGatewayRepository` tests. * test: Use Fake instead of Mock. * chore: Fix Markdown errors. * chore: Explicit use of `HttpStatus` codes. * adds one more worker and compression for catgateway logs (#400) * feat: Collect flutter code coverage (#404) * test: Fix tests after cat-gateway update. * docs: Add `CatalystDataGatewayRepository` usage examples. * docs: Move docs from README to code comment. * test: Update `CatalystDataGatewayRepository` tests. * test: Use Fake instead of Mock. * chore: Fix Markdown errors. * chore: Explicit use of `HttpStatus` codes. * chore(deps-dev): bump vite in /utilities/wallet-tester (#397) Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 5.1.6 to 5.1.7. - [Release notes](https://github.com/vitejs/vite/releases) - [Changelog](https://github.com/vitejs/vite/blob/v5.1.7/packages/vite/CHANGELOG.md) - [Commits](https://github.com/vitejs/vite/commits/v5.1.7/packages/vite) --- updated-dependencies: - dependency-name: vite dependency-type: direct:development ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Apisit Ritreungroj <[email protected]> * feat: Get slot number by provided date-time endpoint (#387) * fix CardanoStakeAddress error handling * refactor, add sync_state_get endpoint * refactor types * refactor * add block_hash validation * wip * wip * wip * wip * add check_network fn * fix * fix schematisis test * try * wip * try * try * try * try * wip * try * try * fix * update Network * add test_utxo test * try * fix * try * fix * wip * fix * fix docket-compose.yml file * try * try * fix * try * try * try * try * wip * fix * wip * try * try * wip * try * try * revert * wip * wip * wip * fix * fix * fix * remove mithril_snapshot loader * wip * wip * wip * wip * wip * wip * wip * add stake addr bech32 encode utils function * wip * wip * update indexing of the utxo data * fix spelling * wip * wip * finish utxo test * fix deny * fix check * fix * fix * update earthly builder versions * wip * ignore test_utxo.py in CI * dont ignore tests * add date_time_to_slot_number_get endpoint * add sql queries * fix * update slot info, fix follower indexing block time issue * add previous slot info field * fix * refactor * fix sync_state_get * wip * fix check * try * fix * finish slot_info test, fix queries * fix * cleanup * wip * wip * wip * feat: RBAC Documentation Drafting (#332) * chore: wip * Update 0005-flutter-app.md * Update 0005-flutter-app.md * Update 0005-flutter-app.md * Update 0005-flutter-app.md * Update 0005-flutter-app.md * Update 0005-flutter-app.md * Update 0005-flutter-app.md * Update 0005-flutter-app.md * Update 0005-flutter-app.md * Update 0005-flutter-app.md * Update 0005-flutter-app.md * docs(docs): Use latest docs builders and fix concepts page * docs(cips): Start drafting the CIPS for milestone 2 * docs(cips): More text for RBAC metadata draft * docs(cips): WIP updates to draft cip for role registration * docs(cips): define draft specification for a ULID cbor tag * docs(cips): Further WIP edits to RBAC * docs(cips): fix ulid spec binary encoding reference * docs(cips): Add a tag to the epoch time. * docs(cips): Add CBOR tag cip for ED25519-BIP32 Keys, Derivation paths and Signatures * docs(cips): Properly define the field tags to use where known, and clean up Stake Address specification. * docs(cips): Fix nonce so its reliable without needing blockchain data * docs(cips): updates * docs(docs): Add CDDL definition for POC x509 envelope metadata * fix(vscode): update vscode extension recommendations * docs(cips): rbac x509 envelope fix * docs(cips): wip updates to high level docs * docs(cips): Add overview of cardano transaction processign and data * docs(cips): update cardano block to be complete for clarity * docs(cips): fix layout engine * docs(cips): wip cddl for envelope metadata * docs(cips): Add cddl specs and diagrams for x509 rbac registration work * docs(cips): Add full transaction/metadata relationship diagram * refactor(cips): reorganize documentation ready for drafting descriptive prose about the formats and uses * docs(cips): add cip draft for catalyst roles using the x509-rbac standard * docs(cips): Add c509 cddl with restrictions and enhancements for plutus usage * docs(cips): Metadata envelope specification draft complete * Update docs/src/catalyst-standards/draft-cips/c509-plutus-restricted-certificate/c509-cert-plutus-restricted.cddl Co-authored-by: bkioshn <[email protected]> * Update docs/src/catalyst-standards/draft-cips/c509-plutus-restricted-certificate/c509-cert-plutus-restricted.cddl Co-authored-by: bkioshn <[email protected]> * Update docs/src/catalyst-standards/draft-cips/x509-role-registration-metadata/x509-roles.cddl Co-authored-by: bkioshn <[email protected]> * Update docs/src/catalyst-standards/draft-cips/x509-role-registration-metadata/x509-roles.cddl Co-authored-by: bkioshn <[email protected]> * Update docs/src/catalyst-standards/draft-cips/x509-envelope-metadata/x509-envelope.cddl Co-authored-by: bkioshn <[email protected]> * Update docs/src/catalyst-standards/draft-cips/x509-envelope-metadata/x509-envelope.cddl Co-authored-by: bkioshn <[email protected]> * Update docs/src/catalyst-standards/draft-cips/x509-envelope-metadata/x509-envelope.cddl Co-authored-by: bkioshn <[email protected]> * Update docs/src/catalyst-standards/draft-cips/c509-plutus-restricted-certificate/c509-cert-plutus-restricted.cddl Co-authored-by: bkioshn <[email protected]> * docs(cips): Fix time and algorithm comments * build(frontend): Relax flutter/dart version requirements to last minor release * docs(cips): wip * fix(cips): rename draft x509 envelope CIP so its easier to identify * docs(cips): WIP updates to x509 roles * fix(cips): rename RBAC definition CIP draft so its easier to identify * docs(cips): x509 certificate registration format fully defined * docs(cips): Document the restricted plutus subset. * docs(cips): Add document detailing how CIP-30 is used to sign the transaction * fix(cips): remove trailing spaces * fix(cips): Fix line lengths * fix(cips): Correct spelling * fix(cips): spelling * fix(frontend): revert changes to flutter/dart versions * fix(frontend): more flutter/dart version corrections * fix(frontend): Revert flutter files to same as main branch * fix(frontend): revert more flutter .yml files to those in main * fix(cips): Fix links between files * docs(cips): Add catalyst specific role registration documentation * docs(spelling): fix spelling --------- Co-authored-by: minikin <[email protected]> Co-authored-by: bkioshn <[email protected]> * ci: configure static analysis & code formatting check * style: formatting * fix: revert browser installation scripts * style: format code * ci: optimize directions include in repo-catalyst-voices-all artifact to include only needed ones * refactor: remove empty tests * ci: add melos script to generate test reports * ci: melos script to generate test report * style: revert previously generated files formatting * style: format files * ci: update melos to exclude generated code form code coverage * ci: cleanup build script * ci: generate multiple junit test reports and save them at /test_reports * ci: depend on melos analyze instead of custom command * docs: improve melos docs * ci: remove unused melos scripts * ci: format files in test & integration_test directories * ci: break code to make sure CI will report failure for demonstration purposes * style: fix lint issues * ci: change WORKDIR after creating the user to make sure it will be owned by that user * ci: restore root user * Revert "Merge branch 'main' into feat/collect-flutter-code-coverage" This reverts commit d0f66b2, reversing changes made to 39ce401. * style: format code * ci: revert test-unit target name --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: Lucio Baglione <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Apisit Ritreungroj <[email protected]> Co-authored-by: Alex Pozhylenkov <[email protected]> Co-authored-by: Steven Johnson <[email protected]> Co-authored-by: minikin <[email protected]> Co-authored-by: bkioshn <[email protected]> * refactor: update schema_validation check (#414) * update schema_validation check * wip * fix * update MismatchedSchema and NoDatabaseUrl error handling * update get_follower_config error handling * update follower queries error handling * fix * update legacy queries * update utxo queries error handling * fix * wip * remove service error type * update registration error handling * wip * fix --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: Lucio Baglione <[email protected]> Co-authored-by: Stefano Cunego <[email protected]> Co-authored-by: Dominik Toton <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Apisit Ritreungroj <[email protected]> Co-authored-by: Steven Johnson <[email protected]> Co-authored-by: minikin <[email protected]> Co-authored-by: bkioshn <[email protected]>
1 parent 3db8f17 commit fb19645

28 files changed

+225
-295
lines changed

catalyst-gateway/bin/src/cli.rs

+1-12
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,6 @@ use crate::{
1212
state::State,
1313
};
1414

15-
#[derive(thiserror::Error, Debug)]
16-
/// All service errors
17-
pub(crate) enum Error {
18-
#[error(transparent)]
19-
/// Service oriented errors
20-
Service(#[from] service::Error),
21-
#[error(transparent)]
22-
/// DB oriented errors
23-
EventDb(#[from] crate::event_db::error::Error),
24-
}
25-
2615
#[derive(Parser)]
2716
#[clap(rename_all = "kebab-case")]
2817
/// Simple service CLI options
@@ -77,7 +66,7 @@ impl Cli {
7766

7867
match event_db.get_follower_config().await {
7968
Ok(config) => break config,
80-
Err(err) => error!("no config {:?}", err),
69+
Err(err) => error!("No follower config found, error: {err}"),
8170
}
8271
};
8372

catalyst-gateway/bin/src/event_db/config.rs

+9-10
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ use std::str::FromStr;
44
use cardano_chain_follower::Network;
55
use serde::{Deserialize, Serialize};
66

7-
use crate::event_db::{Error, EventDB};
7+
use super::error::NotFoundError;
8+
use crate::event_db::EventDB;
89

910
/// Representation of the `config` table id fields `id`, `id2`, `id3`
1011
enum ConfigId {
@@ -51,7 +52,7 @@ pub(crate) struct MithrilSnapshotConfig {
5152

5253
impl EventDB {
5354
/// Config query
54-
pub(crate) async fn get_follower_config(&self) -> Result<Vec<FollowerConfig>, Error> {
55+
pub(crate) async fn get_follower_config(&self) -> anyhow::Result<Vec<FollowerConfig>> {
5556
let conn = self.pool.get().await?;
5657

5758
let id = "cardano";
@@ -66,31 +67,29 @@ impl EventDB {
6667

6768
let mut follower_configs = Vec::new();
6869
for row in rows {
69-
let network = Network::from_str(row.try_get::<_, &str>(ConfigId::Id3.as_str())?)
70-
.map_err(|e| Error::Unknown(e.to_string()))?;
70+
let network = Network::from_str(row.try_get::<_, &str>(ConfigId::Id3.as_str())?)?;
7171
let config: serde_json::Value = row.try_get("value")?;
7272

7373
let relay = config
7474
.get("relay")
75-
.ok_or(Error::JsonParseIssue(
75+
.ok_or(anyhow::anyhow!(
7676
"Cardano follower config does not have `relay` property".to_string(),
7777
))?
7878
.as_str()
79-
.ok_or(Error::JsonParseIssue(
79+
.ok_or(anyhow::anyhow!(
8080
"Cardano follower config `relay` not a string type".to_string(),
8181
))?
8282
.to_string();
8383

8484
let mithril_snapshot = serde_json::from_value(
8585
config
8686
.get("mithril_snapshot")
87-
.ok_or(Error::JsonParseIssue(
87+
.ok_or(anyhow::anyhow!(
8888
"Cardano follower config does not have `mithril_snapshot` property"
8989
.to_string(),
9090
))?
9191
.clone(),
92-
)
93-
.map_err(|e| Error::JsonParseIssue(e.to_string()))?;
92+
)?;
9493

9594
follower_configs.push(FollowerConfig {
9695
network,
@@ -100,7 +99,7 @@ impl EventDB {
10099
}
101100

102101
if follower_configs.is_empty() {
103-
Err(Error::NoConfig)
102+
Err(NotFoundError.into())
104103
} else {
105104
Ok(follower_configs)
106105
}
+3-53
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,6 @@
11
//! Database Errors
22
3-
use bb8::RunError;
4-
5-
/// Event database errors
3+
/// DB not found error
64
#[derive(thiserror::Error, Debug, PartialEq, Eq)]
7-
pub(crate) enum Error {
8-
/// Schema in database does not match schema supported by the Crate.
9-
#[error(" Schema in database does not match schema supported by the Crate. The current schema version: {was}, the schema version we expected: {expected}")]
10-
MismatchedSchema {
11-
/// The current DB schema version.
12-
was: i32,
13-
/// The expected DB schema version.
14-
expected: i32,
15-
},
16-
/// No DB URL was provided
17-
#[error("DB URL is undefined")]
18-
NoDatabaseUrl,
19-
/// Cannot find this item
20-
#[error("Cannot find this item")]
21-
NotFound,
22-
/// DB connection timeout
23-
#[error("Connection to DB timed out")]
24-
TimedOut,
25-
/// Unknown error
26-
#[error("error: {0}")]
27-
Unknown(String),
28-
/// No config
29-
#[error("No config")]
30-
NoConfig,
31-
/// JSON Parsing error
32-
#[error("Unable to parse database data: {0}")]
33-
JsonParseIssue(String),
34-
/// Unable to extract policy assets
35-
#[error("Unable parse assets: {0}")]
36-
AssetParsingIssue(String),
37-
/// Unable to extract hashed witnesses
38-
#[allow(dead_code)]
39-
#[error("Unable to extract hashed witnesses: {0}")]
40-
HashedWitnessExtraction(String),
41-
}
42-
43-
impl From<RunError<tokio_postgres::Error>> for Error {
44-
fn from(val: RunError<tokio_postgres::Error>) -> Self {
45-
match val {
46-
RunError::TimedOut => Self::TimedOut,
47-
RunError::User(_) => Self::Unknown(val.to_string()),
48-
}
49-
}
50-
}
51-
52-
impl From<tokio_postgres::Error> for Error {
53-
fn from(val: tokio_postgres::Error) -> Self {
54-
Self::Unknown(val.to_string())
55-
}
56-
}
5+
#[error("Cannot find this item")]
6+
pub(crate) struct NotFoundError;

catalyst-gateway/bin/src/event_db/follower/mod.rs

+11-16
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
use cardano_chain_follower::Network;
44
use handlebars::Handlebars;
55

6-
use crate::event_db::{Error, EventDB};
6+
use super::error::NotFoundError;
7+
use crate::event_db::EventDB;
78

89
/// Block time
910
pub type DateTime = chrono::DateTime<chrono::offset::Utc>;
@@ -55,7 +56,7 @@ struct SlotInfoQueryTmplFields {
5556

5657
impl SlotInfoQueryType {
5758
/// Get SQL query
58-
fn get_sql_query(&self) -> Result<String, Error> {
59+
fn get_sql_query(&self) -> anyhow::Result<String> {
5960
let tmpl_fields = match self {
6061
SlotInfoQueryType::Previous => {
6162
SlotInfoQueryTmplFields {
@@ -81,8 +82,7 @@ impl SlotInfoQueryType {
8182
// disable default `html_escape` function
8283
// which transforms `<`, `>` symbols to `&lt`, `&gt`
8384
reg.register_escape_fn(|s| s.into());
84-
reg.render_template(SLOT_INFO_SQL_HBS, &tmpl_fields)
85-
.map_err(|e| Error::Unknown(e.to_string()))
85+
Ok(reg.render_template(SLOT_INFO_SQL_HBS, &tmpl_fields)?)
8686
}
8787
}
8888

@@ -91,7 +91,7 @@ impl EventDB {
9191
pub(crate) async fn index_follower_data(
9292
&self, slot_no: SlotNumber, network: Network, epoch_no: EpochNumber, block_time: DateTime,
9393
block_hash: BlockHash,
94-
) -> Result<(), Error> {
94+
) -> anyhow::Result<()> {
9595
let conn = self.pool.get().await?;
9696

9797
let _rows = conn
@@ -110,7 +110,7 @@ impl EventDB {
110110
/// Get slot info for the provided date-time and network and query type
111111
pub(crate) async fn get_slot_info(
112112
&self, date_time: DateTime, network: Network, query_type: SlotInfoQueryType,
113-
) -> Result<(SlotNumber, BlockHash, DateTime), Error> {
113+
) -> anyhow::Result<(SlotNumber, BlockHash, DateTime)> {
114114
let conn = self.pool.get().await?;
115115

116116
let rows = conn
@@ -120,9 +120,7 @@ impl EventDB {
120120
])
121121
.await?;
122122

123-
let Some(row) = rows.first() else {
124-
return Err(Error::NotFound);
125-
};
123+
let row = rows.first().ok_or(NotFoundError)?;
126124

127125
let slot_number: SlotNumber = row.try_get(SLOT_NO_COLUMN)?;
128126
let block_hash = row.try_get(BLOCK_HASH_COLUMN)?;
@@ -134,16 +132,14 @@ impl EventDB {
134132
/// Start follower from where previous follower left off.
135133
pub(crate) async fn last_updated_metadata(
136134
&self, network: Network,
137-
) -> Result<(SlotNumber, BlockHash, DateTime), Error> {
135+
) -> anyhow::Result<(SlotNumber, BlockHash, DateTime)> {
138136
let conn = self.pool.get().await?;
139137

140138
let rows = conn
141139
.query(SELECT_UPDATE_STATE_SQL, &[&network.to_string()])
142140
.await?;
143141

144-
let Some(row) = rows.first() else {
145-
return Err(Error::NotFound);
146-
};
142+
let row = rows.first().ok_or(NotFoundError)?;
147143

148144
let slot_no = row.try_get(SLOT_NO_COLUMN)?;
149145
let block_hash = row.try_get(BLOCK_HASH_COLUMN)?;
@@ -157,7 +153,7 @@ impl EventDB {
157153
pub(crate) async fn refresh_last_updated(
158154
&self, last_updated: DateTime, slot_no: SlotNumber, block_hash: BlockHash,
159155
network: Network, machine_id: &MachineId,
160-
) -> Result<(), Error> {
156+
) -> anyhow::Result<()> {
161157
let conn = self.pool.get().await?;
162158

163159
// Rollback or update
@@ -169,8 +165,7 @@ impl EventDB {
169165
// All future additions are just updates on ended, slot_no and block_hash
170166
let _rows = conn
171167
.query(INSERT_UPDATE_STATE_SQL, &[
172-
&i64::try_from(network_id)
173-
.map_err(|_| Error::Unknown("Network id out of range".to_string()))?,
168+
&i64::try_from(network_id)?,
174169
&last_updated,
175170
&last_updated,
176171
&machine_id,

catalyst-gateway/bin/src/event_db/legacy/queries/event/ballot.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
use std::collections::HashMap;
33

44
use crate::event_db::{
5-
error::Error,
5+
error::NotFoundError,
66
legacy::types::{
77
ballot::{
88
Ballot, BallotType, GroupVotePlans, ObjectiveBallots, ObjectiveChoices, ProposalBallot,
@@ -52,7 +52,7 @@ impl EventDB {
5252
#[allow(dead_code)]
5353
pub(crate) async fn get_ballot(
5454
&self, event: EventId, objective: ObjectiveId, proposal: ProposalId,
55-
) -> Result<Ballot, Error> {
55+
) -> anyhow::Result<Ballot> {
5656
let conn = self.pool.get().await?;
5757

5858
let rows = conn
@@ -62,7 +62,7 @@ impl EventDB {
6262
&proposal.0,
6363
])
6464
.await?;
65-
let row = rows.first().ok_or(Error::NotFound)?;
65+
let row = rows.first().ok_or(NotFoundError)?;
6666
let choices = row.try_get("objective")?;
6767

6868
let rows = conn
@@ -95,7 +95,7 @@ impl EventDB {
9595
#[allow(dead_code)]
9696
pub(crate) async fn get_objective_ballots(
9797
&self, event: EventId, objective: ObjectiveId,
98-
) -> Result<Vec<ProposalBallot>, Error> {
98+
) -> anyhow::Result<Vec<ProposalBallot>> {
9999
let conn = self.pool.get().await?;
100100

101101
let rows = conn
@@ -145,7 +145,7 @@ impl EventDB {
145145
#[allow(dead_code)]
146146
pub(crate) async fn get_event_ballots(
147147
&self, event: EventId,
148-
) -> Result<Vec<ObjectiveBallots>, Error> {
148+
) -> anyhow::Result<Vec<ObjectiveBallots>> {
149149
let conn = self.pool.get().await?;
150150

151151
let rows = conn

catalyst-gateway/bin/src/event_db/legacy/queries/event/mod.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
use chrono::{NaiveDateTime, Utc};
33

44
use crate::event_db::{
5-
error::Error,
5+
error::NotFoundError,
66
legacy::types::event::{
77
Event, EventDetails, EventGoal, EventId, EventRegistration, EventSchedule, EventSummary,
88
VotingPowerAlgorithm, VotingPowerSettings,
@@ -44,7 +44,7 @@ impl EventDB {
4444
#[allow(dead_code)]
4545
pub(crate) async fn get_events(
4646
&self, limit: Option<i64>, offset: Option<i64>,
47-
) -> Result<Vec<EventSummary>, Error> {
47+
) -> anyhow::Result<Vec<EventSummary>> {
4848
let conn = self.pool.get().await?;
4949

5050
let rows = conn
@@ -76,11 +76,11 @@ impl EventDB {
7676

7777
/// Get event query
7878
#[allow(dead_code)]
79-
pub(crate) async fn get_event(&self, event: EventId) -> Result<Event, Error> {
79+
pub(crate) async fn get_event(&self, event: EventId) -> anyhow::Result<Event> {
8080
let conn = self.pool.get().await?;
8181

8282
let rows = conn.query(Self::EVENT_QUERY, &[&event.0]).await?;
83-
let row = rows.first().ok_or(Error::NotFound)?;
83+
let row = rows.first().ok_or(NotFoundError)?;
8484

8585
let ends = row
8686
.try_get::<&'static str, Option<NaiveDateTime>>("end_time")?

catalyst-gateway/bin/src/event_db/legacy/queries/event/objective.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
//! Objective Queries
22
use crate::event_db::{
3-
error::Error,
43
legacy::types::{
54
event::EventId,
65
objective::{
@@ -33,7 +32,7 @@ impl EventDB {
3332
#[allow(dead_code)]
3433
pub(crate) async fn get_objectives(
3534
&self, event: EventId, limit: Option<i64>, offset: Option<i64>,
36-
) -> Result<Vec<Objective>, Error> {
35+
) -> anyhow::Result<Vec<Objective>> {
3736
let conn = self.pool.get().await?;
3837

3938
let rows = conn

catalyst-gateway/bin/src/event_db/legacy/queries/event/proposal.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//! Proposal Queries
22
use crate::event_db::{
3-
error::Error,
3+
error::NotFoundError,
44
legacy::types::{
55
event::EventId,
66
objective::ObjectiveId,
@@ -32,15 +32,15 @@ impl EventDB {
3232
#[allow(dead_code)]
3333
pub(crate) async fn get_proposal(
3434
&self, event: EventId, objective: ObjectiveId, proposal: ProposalId,
35-
) -> Result<Proposal, Error> {
35+
) -> anyhow::Result<Proposal> {
3636
let conn: bb8::PooledConnection<
3737
bb8_postgres::PostgresConnectionManager<tokio_postgres::NoTls>,
3838
> = self.pool.get().await?;
3939

4040
let rows = conn
4141
.query(Self::PROPOSAL_QUERY, &[&event.0, &objective.0, &proposal.0])
4242
.await?;
43-
let row = rows.first().ok_or(Error::NotFound)?;
43+
let row = rows.first().ok_or(NotFoundError)?;
4444

4545
let proposer = vec![ProposerDetails {
4646
name: row.try_get("proposer_name")?,
@@ -71,7 +71,7 @@ impl EventDB {
7171
#[allow(dead_code)]
7272
pub(crate) async fn get_proposals(
7373
&self, event: EventId, objective: ObjectiveId, limit: Option<i64>, offset: Option<i64>,
74-
) -> Result<Vec<ProposalSummary>, Error> {
74+
) -> anyhow::Result<Vec<ProposalSummary>> {
7575
let conn = self.pool.get().await?;
7676

7777
let rows = conn

0 commit comments

Comments
 (0)