otp_std/
int.rs

1//! Integer parsing errors.
2
3use std::num::ParseIntError;
4
5use miette::Diagnostic;
6use thiserror::Error;
7
8/// Wraps [`ParseIntError`] to provide diagnostics.
9#[derive(Debug, Error, Diagnostic)]
10#[error("failed to parse integer")]
11#[diagnostic(code(otp_std::int::parse), help("ensure the input is valid"))]
12pub struct ParseError(#[from] pub ParseIntError);
13
14/// Wraps the given error into [`struct@ParseError`].
15pub const fn wrap(error: ParseIntError) -> ParseError {
16    ParseError(error)
17}