global: improve errors

This commit is contained in:
nym21
2025-12-16 20:49:19 +01:00
parent 3ca83a2289
commit 1ad8d8a631
36 changed files with 232 additions and 334 deletions

View File

@@ -28,7 +28,7 @@ impl Query {
let max_height = self.height();
if height > max_height {
return Err(Error::Str("Block height out of range"));
return Err(Error::OutOfRange("Block height out of range".into()));
}
let first_txindex = indexer.vecs.tx.height_to_first_txindex.read_once(height)?;
@@ -64,7 +64,7 @@ impl Query {
let max_height = self.height();
if height > max_height {
return Err(Error::Str("Block height out of range"));
return Err(Error::OutOfRange("Block height out of range".into()));
}
let first_txindex = indexer.vecs.tx.height_to_first_txindex.read_once(height)?;
@@ -101,7 +101,7 @@ impl Query {
let max_height = self.height();
if height > max_height {
return Err(Error::Str("Block height out of range"));
return Err(Error::OutOfRange("Block height out of range".into()));
}
let first_txindex = indexer.vecs.tx.height_to_first_txindex.read_once(height)?;
@@ -117,7 +117,7 @@ impl Query {
let tx_count = next - first;
if index >= tx_count {
return Err(Error::Str("Transaction index out of range"));
return Err(Error::OutOfRange("Transaction index out of range".into()));
}
let txindex = TxIndex::from(first + index);