and a few more

pull/745/head
Yuri Astrakhan 11 months ago
parent 487f61f704
commit 389347e04e
  1. 13
      lib/oxsdatatypes/src/date_time.rs
  2. 12
      lib/oxsdatatypes/src/decimal.rs
  3. 12
      lib/oxsdatatypes/src/integer.rs

@ -2,7 +2,6 @@
use crate::{DayTimeDuration, Decimal, Duration, YearMonthDuration}; use crate::{DayTimeDuration, Decimal, Duration, YearMonthDuration};
use std::cmp::{min, Ordering}; use std::cmp::{min, Ordering};
use std::error::Error;
use std::fmt; use std::fmt;
use std::hash::{Hash, Hasher}; use std::hash::{Hash, Hasher};
use std::str::FromStr; use std::str::FromStr;
@ -2387,17 +2386,10 @@ fn validate_day_of_month(year: Option<i64>, month: u8, day: u8) -> Result<(), Pa
/// An overflow during [`DateTime`]-related operations. /// An overflow during [`DateTime`]-related operations.
/// ///
/// Matches XPath [`FODT0001` error](https://www.w3.org/TR/xpath-functions-31/#ERRFODT0001). /// Matches XPath [`FODT0001` error](https://www.w3.org/TR/xpath-functions-31/#ERRFODT0001).
#[derive(Debug, Clone, Copy)] #[derive(Debug, Clone, Copy, thiserror::Error)]
#[error("overflow during xsd:dateTime computation")]
pub struct DateTimeOverflowError; pub struct DateTimeOverflowError;
impl fmt::Display for DateTimeOverflowError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_str("overflow during xsd:dateTime computation")
}
}
impl Error for DateTimeOverflowError {}
/// The value provided as timezone is not valid. /// The value provided as timezone is not valid.
/// ///
/// Matches XPath [`FODT0003` error](https://www.w3.org/TR/xpath-functions-31/#ERRFODT0003). /// Matches XPath [`FODT0003` error](https://www.w3.org/TR/xpath-functions-31/#ERRFODT0003).
@ -2414,6 +2406,7 @@ mod tests {
#![allow(clippy::panic_in_result_fn)] #![allow(clippy::panic_in_result_fn)]
use super::*; use super::*;
use std::error::Error;
#[test] #[test]
fn from_str() -> Result<(), ParseDateTimeError> { fn from_str() -> Result<(), ParseDateTimeError> {

@ -1,5 +1,4 @@
use crate::{Boolean, Double, Float, Integer, TooLargeForIntegerError}; use crate::{Boolean, Double, Float, Integer, TooLargeForIntegerError};
use std::error::Error;
use std::fmt; use std::fmt;
use std::fmt::Write; use std::fmt::Write;
use std::str::FromStr; use std::str::FromStr;
@ -630,17 +629,10 @@ impl From<TooLargeForDecimalError> for ParseDecimalError {
/// The input is too large to fit into a [`Decimal`]. /// The input is too large to fit into a [`Decimal`].
/// ///
/// Matches XPath [`FOCA0001` error](https://www.w3.org/TR/xpath-functions-31/#ERRFOCA0001). /// Matches XPath [`FOCA0001` error](https://www.w3.org/TR/xpath-functions-31/#ERRFOCA0001).
#[derive(Debug, Clone, Copy)] #[derive(Debug, Clone, Copy, thiserror::Error)]
#[error("Value too large for xsd:decimal internal representation")]
pub struct TooLargeForDecimalError; pub struct TooLargeForDecimalError;
impl fmt::Display for TooLargeForDecimalError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_str("Value too large for xsd:decimal internal representation")
}
}
impl Error for TooLargeForDecimalError {}
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
#![allow(clippy::panic_in_result_fn)] #![allow(clippy::panic_in_result_fn)]

@ -1,5 +1,4 @@
use crate::{Boolean, Decimal, Double, Float}; use crate::{Boolean, Decimal, Double, Float};
use std::error::Error;
use std::fmt; use std::fmt;
use std::num::ParseIntError; use std::num::ParseIntError;
use std::str::FromStr; use std::str::FromStr;
@ -264,17 +263,10 @@ impl TryFrom<Double> for Integer {
/// The input is too large to fit into an [`Integer`]. /// The input is too large to fit into an [`Integer`].
/// ///
/// Matches XPath [`FOCA0003` error](https://www.w3.org/TR/xpath-functions-31/#ERRFOCA0003). /// Matches XPath [`FOCA0003` error](https://www.w3.org/TR/xpath-functions-31/#ERRFOCA0003).
#[derive(Debug, Clone, Copy)] #[derive(Debug, Clone, Copy, thiserror::Error)]
#[error("Value too large for xsd:integer internal representation")]
pub struct TooLargeForIntegerError; pub struct TooLargeForIntegerError;
impl fmt::Display for TooLargeForIntegerError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_str("Value too large for xsd:integer internal representation")
}
}
impl Error for TooLargeForIntegerError {}
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
#![allow(clippy::panic_in_result_fn)] #![allow(clippy::panic_in_result_fn)]

Loading…
Cancel
Save