binius_m3/builder/
error.rs

1// Copyright 2025 Irreducible Inc.
2
3use std::cell::{BorrowError, BorrowMutError};
4
5use binius_core::{oracle::Error as OracleError, polynomial::Error as PolynomialError};
6use binius_math::Error as MathError;
7
8use super::{column::ColumnId, table::TableId};
9
10#[derive(Debug, thiserror::Error)]
11pub enum Error {
12	#[error("statement table sizes does not match the number of tables; expected {expected}, got {actual}")]
13	StatementMissingTableSize { expected: usize, actual: usize },
14	#[error("missing table with ID: {table_id}")]
15	MissingTable { table_id: TableId },
16	#[error("missing column with ID: {0:?}")]
17	MissingColumn(ColumnId),
18	#[error("missing partition with log_vals_per_row={log_vals_per_row} in table {table_id}")]
19	MissingPartition {
20		table_id: TableId,
21		log_vals_per_row: usize,
22	},
23	#[error("cannot construct witness index for empty table {table_id}")]
24	EmptyTable { table_id: TableId },
25	#[error("column is not in table; column table ID: {column_table_id}, witness table ID: {witness_table_id}")]
26	TableMismatch {
27		column_table_id: TableId,
28		witness_table_id: TableId,
29	},
30	// TODO: These should have column IDs
31	#[error("witness borrow error: {0}. Note that packed columns are aliases for the unpacked column when accessing witness data")]
32	WitnessBorrow(#[source] BorrowError),
33	#[error("witness borrow error: {0}. Note that packed columns are aliases for the unpacked column when accessing witness data")]
34	WitnessBorrowMut(#[source] BorrowMutError),
35	#[error(
36		"the table index was initialized for {expected} events; attempted to fill with {actual}"
37	)]
38	IncorrectNumberOfTableEvents { expected: usize, actual: usize },
39	#[error("table fill error: {0}")]
40	TableFill(anyhow::Error),
41	#[error("math error: {0}")]
42	Math(#[from] MathError),
43	#[error("oracle error: {0}")]
44	Oracle(#[from] OracleError),
45	#[error("polynomial error: {0}")]
46	Polynomial(#[from] PolynomialError),
47}