@@ -5,6 +5,48 @@ use std::io;
5
5
use super :: TableColumn ;
6
6
use super :: { Any , Column } ;
7
7
8
+ /// This is an error that could occur during table synthesis.
9
+ #[ derive( Debug ) ]
10
+ pub enum TableError {
11
+ /// A `TableColumn` has not been assigned.
12
+ ColumnNotAssigned ( TableColumn ) ,
13
+ /// A Table has columns of uneven lengths.
14
+ UnevenColumnLengths ( ( TableColumn , usize ) , ( TableColumn , usize ) ) ,
15
+ /// Attempt to assign a used `TableColumn`
16
+ UsedColumn ( TableColumn ) ,
17
+ /// Attempt to overwrite a default value
18
+ OverwriteDefault ( TableColumn , String , String ) ,
19
+ }
20
+
21
+ impl fmt:: Display for TableError {
22
+ fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
23
+ match self {
24
+ TableError :: ColumnNotAssigned ( col) => {
25
+ write ! (
26
+ f,
27
+ "{:?} not fully assigned. Help: assign a value at offset 0." ,
28
+ col
29
+ )
30
+ }
31
+ TableError :: UnevenColumnLengths ( ( col, col_len) , ( col2, col2_len) ) => write ! (
32
+ f,
33
+ "{:?} has length {} while {:?} has length {}" ,
34
+ col, col_len, col2, col2_len
35
+ ) ,
36
+ TableError :: UsedColumn ( col) => {
37
+ write ! ( f, "{:?} has already been used" , col)
38
+ }
39
+ TableError :: OverwriteDefault ( col, default, val) => {
40
+ write ! (
41
+ f,
42
+ "Attempted to overwrite default value {} with {} in {:?}" ,
43
+ default , val, col
44
+ )
45
+ }
46
+ }
47
+ }
48
+ }
49
+
8
50
/// This is an error that could occur during proving or circuit synthesis.
9
51
// TODO: these errors need to be cleaned up
10
52
#[ non_exhaustive]
@@ -81,7 +123,7 @@ impl fmt::Display for Error {
81
123
}
82
124
Error :: ColumnNotInPermutation ( column) => write ! (
83
125
f,
84
- "Column {:?} must be included in the permutation. Help: try applying `meta.enable_equalty ` on the column" ,
126
+ "Column {:?} must be included in the permutation. Help: try applying `meta.enable_equality ` on the column" ,
85
127
column
86
128
) ,
87
129
Error :: TableError ( error) => write ! ( f, "{}" , error) ,
@@ -101,45 +143,3 @@ impl error::Error for Error {
101
143
}
102
144
}
103
145
}
104
-
105
- /// This is an error that could occur during table synthesis.
106
- #[ derive( Debug ) ]
107
- pub enum TableError {
108
- /// A `TableColumn` has not been assigned.
109
- ColumnNotAssigned ( TableColumn ) ,
110
- /// A Table has columns of uneven lengths.
111
- UnevenColumnLengths ( ( TableColumn , usize ) , ( TableColumn , usize ) ) ,
112
- /// Attempt to assign a used `TableColumn`
113
- UsedColumn ( TableColumn ) ,
114
- /// Attempt to overwrite a default value
115
- OverwriteDefault ( TableColumn , String , String ) ,
116
- }
117
-
118
- impl fmt:: Display for TableError {
119
- fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
120
- match self {
121
- TableError :: ColumnNotAssigned ( col) => {
122
- write ! (
123
- f,
124
- "{:?} not fully assigned. Help: assign a value at offset 0." ,
125
- col
126
- )
127
- }
128
- TableError :: UnevenColumnLengths ( ( col, col_len) , ( table, table_len) ) => write ! (
129
- f,
130
- "{:?} has length {} while {:?} has length {}" ,
131
- col, col_len, table, table_len
132
- ) ,
133
- TableError :: UsedColumn ( col) => {
134
- write ! ( f, "{:?} has already been used" , col)
135
- }
136
- TableError :: OverwriteDefault ( col, default, val) => {
137
- write ! (
138
- f,
139
- "Attempted to overwrite default value {} with {} in {:?}" ,
140
- default , val, col
141
- )
142
- }
143
- }
144
- }
145
- }
0 commit comments