Skip to content

Commit

Permalink
docs: add doc comments for error structs
Browse files Browse the repository at this point in the history
  • Loading branch information
lgiussan committed Sep 25, 2024
1 parent edf29fe commit 990e2d1
Show file tree
Hide file tree
Showing 16 changed files with 79 additions and 79 deletions.
6 changes: 3 additions & 3 deletions crates/proof-of-sql-parser/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,19 @@ pub enum ParseError {
#[snafu(display("Unable to parse query"))]
/// Cannot parse the query
QueryParseError {
#[allow(missing_docs)]
/// The underlying error
error: String,
},
#[snafu(display("Unable to parse identifier"))]
/// Cannot parse the identifier
IdentifierParseError {
#[allow(missing_docs)]
/// The underlying error
error: String,
},
#[snafu(display("Unable to parse resource_id"))]
/// Can not parse the resource_id
ResourceIdParseError {
#[allow(missing_docs)]
/// The underlying error
error: String,
},
}
Expand Down
2 changes: 1 addition & 1 deletion crates/proof-of-sql-parser/src/intermediate_decimal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pub enum IntermediateDecimalError {
/// Represents an error encountered during the parsing of a decimal string.
#[snafu(display("{error}"))]
ParseError {
#[allow(missing_docs)]
/// The underlying error
error: ParseBigDecimalError,
},
/// Error occurs when this decimal cannot fit in a primitive.
Expand Down
12 changes: 6 additions & 6 deletions crates/proof-of-sql-parser/src/posql_time/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ pub enum PoSQLTimestampError {
/// Error when the timezone string provided cannot be parsed into a valid timezone.
#[snafu(display("invalid timezone string: {timezone}"))]
InvalidTimezone {
#[allow(missing_docs)]
/// The invalid timezone
timezone: String,
},

Expand All @@ -19,8 +19,8 @@ pub enum PoSQLTimestampError {
/// Indicates a failure to convert between different representations of time units.
#[snafu(display("Invalid time unit"))]
InvalidTimeUnit {
#[allow(missing_docs)]
time_unit: String,
/// The underlying error
error: String,
},

/// The local time does not exist because there is a gap in the local time.
Expand All @@ -33,22 +33,22 @@ pub enum PoSQLTimestampError {
/// This variant contains the two possible results, in the order (earliest, latest).
#[snafu(display("Unix timestamp is ambiguous because there is a fold in the local time."))]
Ambiguous {
#[allow(missing_docs)]
/// The underlying error
error: String,
},

/// Represents a catch-all for parsing errors not specifically covered by other variants.
#[snafu(display("Timestamp parsing error: {error}"))]
ParsingError {
#[allow(missing_docs)]
/// The underlying error
error: String,
},

/// Represents a failure to parse a provided time unit precision value, PoSQL supports
/// Seconds, Milliseconds, Microseconds, and Nanoseconds
#[snafu(display("Timestamp parsing error: {error}"))]
UnsupportedPrecision {
#[allow(missing_docs)]
/// The underlying error
error: String,
},
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pub enum ColumnCommitmentsMismatch {
/// Anonymous metadata indicates a column mismatch.
#[snafu(transparent)]
ColumnCommitmentMetadata {
#[allow(missing_docs)]
/// The underlying source error
source: ColumnCommitmentMetadataMismatch,
},
/// Commitments with different column counts cannot operate with each other.
Expand All @@ -30,9 +30,9 @@ pub enum ColumnCommitmentsMismatch {
"column with identifier {id_a} cannot operate with column with identifier {id_b}"
))]
Identifier {
#[allow(missing_docs)]
/// The first column identifier
id_a: String,
#[allow(missing_docs)]
/// The second column identifier
id_b: String,
},
}
Expand Down
4 changes: 2 additions & 2 deletions crates/proof-of-sql/src/base/commitment/column_commitments.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ pub enum AppendColumnCommitmentsError {
/// Metadata between new and old columns are mismatched.
#[snafu(transparent)]
Mismatch {
#[allow(missing_docs)]
/// The underlying source error
source: ColumnCommitmentsMismatch,
},
/// New columns have duplicate identifiers.
#[snafu(transparent)]
DuplicateIdentifiers {
#[allow(missing_docs)]
/// The underlying source error
source: DuplicateIdentifiers,
},
}
Expand Down
20 changes: 10 additions & 10 deletions crates/proof-of-sql/src/base/commitment/table_commitment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ pub enum TableCommitmentFromColumnsError {
/// Cannot construct [`TableCommitment`] from columns of mixed length.
#[snafu(transparent)]
MixedLengthColumns {
#[allow(missing_docs)]
/// The underlying source error
source: MixedLengthColumns,
},
/// Cannot construct [`TableCommitment`] from columns with duplicate identifiers.
#[snafu(transparent)]
DuplicateIdentifiers {
#[allow(missing_docs)]
/// The underlying source error
source: DuplicateIdentifiers,
},
}
Expand All @@ -50,13 +50,13 @@ pub enum AppendTableCommitmentError {
/// Cannot append columns of mixed length to existing [`TableCommitment`].
#[snafu(transparent)]
MixedLengthColumns {
#[allow(missing_docs)]
/// The underlying source error
source: MixedLengthColumns,
},
/// Encountered error when appending internal [`ColumnCommitments`].
#[snafu(transparent)]
AppendColumnCommitments {
#[allow(missing_docs)]
/// The underlying source error
source: AppendColumnCommitmentsError,
},
}
Expand All @@ -67,13 +67,13 @@ pub enum TableCommitmentArithmeticError {
/// Cannot perform arithmetic on columns with mismatched metadata.
#[snafu(transparent)]
ColumnMismatch {
#[allow(missing_docs)]
/// The underlying source error
source: ColumnCommitmentsMismatch,
},
/// Cannot perform TableCommitment arithmetic that would result in a negative range.
#[snafu(transparent)]
NegativeRange {
#[allow(missing_docs)]
/// The underlying source error
source: NegativeRange,
},
/// Cannot perform arithmetic for noncontiguous table commitments.
Expand All @@ -90,13 +90,13 @@ pub enum RecordBatchToColumnsError {
/// Error converting from arrow array
#[snafu(transparent)]
ArrowArrayToColumnConversionError {
#[allow(missing_docs)]
/// The underlying source error
source: ArrowArrayToColumnConversionError,
},
#[snafu(transparent)]
/// This error occurs when convering from a record batch name to an identifier fails. (Which may be impossible.)
FieldParseFail {
#[allow(missing_docs)]
/// The underlying source error
source: ParseError,
},
}
Expand All @@ -108,13 +108,13 @@ pub enum AppendRecordBatchTableCommitmentError {
/// During commitment operation, metadata indicates that operand tables cannot be the same.
#[snafu(transparent)]
ColumnCommitmentsMismatch {
#[allow(missing_docs)]
/// The underlying source error
source: ColumnCommitmentsMismatch,
},
/// Error converting from arrow array
#[snafu(transparent)]
ArrowBatchToColumnError {
#[allow(missing_docs)]
/// The underlying source error
source: RecordBatchToColumnsError,
},
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,33 +24,33 @@ pub enum ArrowArrayToColumnConversionError {
"unsupported type: attempted conversion from ArrayRef of type {datatype} to OwnedColumn"
))]
UnsupportedType {
#[allow(missing_docs)]
/// The unsupported datatype
datatype: DataType,
},
/// Variant for decimal errors
#[snafu(transparent)]
DecimalError {
#[allow(missing_docs)]
/// The underlying source error
source: crate::base::math::decimal::DecimalError,
},
/// This error occurs when trying to convert from an i256 to a Scalar.
#[snafu(display("decimal conversion failed: {number}"))]
DecimalConversionFailed {
#[allow(missing_docs)]
/// The `i256` value for which conversion is attempted
number: i256,
},
/// This error occurs when the specified range is out of the bounds of the array.
#[snafu(display("index out of bounds: the len is {len} but the index is {index}"))]
IndexOutOfBounds {
#[allow(missing_docs)]
/// The actual length of the array
len: usize,
#[allow(missing_docs)]
/// The out of bounds index requested
index: usize,
},
/// Using TimeError to handle all time-related errors
#[snafu(transparent)]
TimestampConversionError {
#[allow(missing_docs)]
/// The underlying source error
source: PoSQLTimestampError,
},
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ pub enum ColumnOperationError {
/// Two columns do not have the same length
#[snafu(display("Columns have different lengths: {len_a} != {len_b}"))]
DifferentColumnLength {
#[allow(missing_docs)]
/// The length of the first column
len_a: usize,
#[allow(missing_docs)]
/// The length of the second column
len_b: usize,
},

Expand All @@ -37,7 +37,7 @@ pub enum ColumnOperationError {
/// Overflow in integer operations
#[snafu(display("Overflow in integer operation: {error}"))]
IntegerOverflow {
#[allow(missing_docs)]
/// The underlying overflow error
error: String,
},

Expand All @@ -48,7 +48,7 @@ pub enum ColumnOperationError {
/// Errors related to decimal operations
#[snafu(transparent)]
DecimalConversionError {
#[allow(missing_docs)]
/// The underlying source error
source: DecimalError,
},
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,25 @@ pub enum ExpressionEvaluationError {
/// Column not found
#[snafu(display("Column not found: {error}"))]
ColumnNotFound {
#[allow(missing_docs)]
/// The underlying error
error: String,
},
/// Error in column operation
#[snafu(transparent)]
ColumnOperationError {
#[allow(missing_docs)]
/// The underlying source error
source: ColumnOperationError,
},
/// Expression not yet supported
#[snafu(display("Expression {expression} is not supported yet"))]
Unsupported {
#[allow(missing_docs)]
/// The unsupported expression
expression: String,
},
/// Error in decimal conversion
#[snafu(transparent)]
DecimalConversionError {
#[allow(missing_docs)]
/// The underlying source error
source: DecimalError,
},
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ pub enum OwnedArrowConversionError {
"unsupported type: attempted conversion from ArrayRef of type {datatype} to OwnedColumn"
))]
UnsupportedType {
#[allow(missing_docs)]
/// The unsupported datatype
datatype: DataType,
},
/// This error occurs when trying to convert from a record batch with duplicate identifiers (e.g. `"a"` and `"A"`).
Expand All @@ -57,13 +57,13 @@ pub enum OwnedArrowConversionError {
/// This error occurs when convering from a record batch name to an identifier fails. (Which may my impossible.)
#[snafu(transparent)]
FieldParseFail {
#[allow(missing_docs)]
/// The underlying source error
source: ParseError,
},
/// This error occurs when creating an owned table fails, which should only occur when there are zero columns.
#[snafu(transparent)]
InvalidTable {
#[allow(missing_docs)]
/// The underlying source error
source: OwnedTableError,
},
/// This error occurs when trying to convert from an Arrow array with nulls.
Expand All @@ -72,7 +72,7 @@ pub enum OwnedArrowConversionError {
/// Using TimeError to handle all time-related errors
#[snafu(transparent)]
TimestampConversionError {
#[allow(missing_docs)]
/// The underlying source error
source: PoSQLTimestampError,
},
}
Expand Down
4 changes: 2 additions & 2 deletions crates/proof-of-sql/src/base/database/owned_column_error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ pub enum OwnedColumnError {
/// Error in converting scalars to a given column type.
#[snafu(display("Error in converting scalars to a given column type: {error}"))]
ScalarConversionError {
#[allow(missing_docs)]
/// The underlying error
error: String,
},
/// Unsupported operation.
#[snafu(display("Unsupported operation: {error}"))]
Unsupported {
#[allow(missing_docs)]
/// The underlying error
error: String,
},
}
Expand Down
10 changes: 5 additions & 5 deletions crates/proof-of-sql/src/base/math/decimal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pub enum DecimalError {
/// the string isn't even a decimal e.g. "notastring",
/// "-21.233.122" etc aka InvalidDecimal
InvalidDecimal {
#[allow(missing_docs)]
/// The underlying error
error: String,
},

Expand All @@ -25,31 +25,31 @@ pub enum DecimalError {
/// e.g. precision above 75/76/whatever set by Scalar
/// or non-positive aka InvalidPrecision
InvalidPrecision {
#[allow(missing_docs)]
/// The underlying error
error: String,
},

#[snafu(display("Decimal scale is not valid: {scale}"))]
/// Decimal scale is not valid. Here we use i16 in order to include
/// invalid scale values
InvalidScale {
#[allow(missing_docs)]
/// The invalid scale value
scale: i16,
},

#[snafu(display("Unsupported operation: cannot round decimal: {error}"))]
/// This error occurs when attempting to scale a
/// decimal in such a way that a loss of precision occurs.
RoundingError {
#[allow(missing_docs)]
/// The underlying error
error: String,
},

/// Errors that may occur when parsing an intermediate decimal
/// into a posql decimal
#[snafu(transparent)]
IntermediateDecimalConversionError {
#[allow(missing_docs)]
/// The underlying source error
source: IntermediateDecimalError,
},
}
Expand Down
2 changes: 1 addition & 1 deletion crates/proof-of-sql/src/base/scalar/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ pub enum ScalarConversionError {
#[snafu(display("Overflow error: {error}"))]
/// This error occurs when a scalar is too large to be converted.
Overflow {
#[allow(missing_docs)]
/// The underlying error
error: String,
},
}
Loading

0 comments on commit 990e2d1

Please sign in to comment.