use failure::Fail;
#[derive(Debug)]
pub enum Recoverable {
Residual,
LSetup,
LSolve,
Constraint,
NLSSetup,
}
#[derive(Debug, Fail)]
pub enum IdaError {
#[fail(display = "Error Test Failed")]
TestFail,
#[fail(
display = "The user's residual function repeatedly returned a recoverable error flag, \
but the solver was unable to recover"
)]
RepeatedResidualError {},
#[fail(display = "One of the input arguments was illegal. See printed message")]
IllegalInput { msg: String },
#[fail(display = "The linear solver's init routine failed")]
LinearInitFail {},
#[fail(
display = "Some component of the error weight vector is zero (illegal), either for the \
input value of y0 or a corrected value"
)]
BadErrorWeightVector {},
#[fail(display = "The user's residual routine returned a non-recoverable error flag")]
ResidualFail {},
#[fail(
display = "The user's residual routine returned a recoverable error flag on the first \
call, but IDACalcIC was unable to recover"
)]
FirstResidualFail {},
#[fail(display = "The linear solver's setup routine had a non-recoverable error")]
LinearSetupFail {},
#[fail(display = "The linear solver's solve routine had a non-recoverable error")]
LinearSolveFail {},
#[fail(
display = "The user's residual routine, or the linear solver's setup or solve routine \
had a recoverable error, but IDACalcIC was unable to recover"
)]
NoRecovery {},
#[fail(display = "Recoverable failure")]
RecoverableFail { rec_type: Recoverable },
#[fail(
display = "IDACalcIC was unable to find a solution satisfying the inequality constraints"
)]
ConstraintFail {},
#[fail(
display = "The Linesearch algorithm failed to find a solution with a step larger than \
steptol in weighted RMS norm"
)]
LinesearchFail {},
#[fail(display = "IDACalcIC failed to get convergence of the Newton iterations")]
ConvergenceFail {},
#[fail(display = "Illegal value for k.")]
BadK {},
#[fail(
display = "Illegal value for t: t = {} is not between tcur - hu = {} and tcur = {}.",
t, tdiff, tcurr
)]
BadTimeValue { t: f64, tdiff: f64, tcurr: f64 },
#[fail(
display = "At t = {}, the rootfinding routine failed in an unrecoverable manner.",
t
)]
RootFunctionFail { t: f64 },
#[fail(
display = "The value tstop = {} is behind current t = {} in the direction of integration.",
tstop, t
)]
BadStopTime { tstop: f64, t: f64 },
#[fail(display = "At t = {} too much accuracy requested.", t)]
TooMuchAccuracy { t: f64 },
#[fail(display = "Root found at and very near {}.", t)]
CloseRoots { t: f64 },
}