artichoke_backend/extn/core/kernel/
integer.rs1use scolapasta_int_parse::InvalidRadixExceptionKind;
2
3use crate::extn::prelude::*;
4
5impl<'a> From<scolapasta_int_parse::Error<'a>> for Error {
6 fn from(err: scolapasta_int_parse::Error<'a>) -> Self {
7 use scolapasta_int_parse::Error::{Argument, Radix};
8
9 match err {
10 Argument(err) => {
11 let message = err.to_string();
12 ArgumentError::from(message).into()
13 }
14 Radix(err) => match err.exception_kind() {
15 InvalidRadixExceptionKind::ArgumentError => {
16 let message = err.to_string();
17 ArgumentError::from(message).into()
18 }
19 InvalidRadixExceptionKind::RangeError => {
20 let message = err.to_string();
21 RangeError::from(message).into()
22 }
23 },
24 }
25 }
26}