RandLib 2.0.0
Probability distributions, fitting, and heavy-tail tools for C++20
Loading...
Searching...
No Matches
errors.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <stdexcept>
4#include <string>
5
6namespace randlib
7{
8
14class not_implemented : public std::runtime_error
15{
16public:
17 explicit not_implemented(const std::string &what) : std::runtime_error(what) {}
18};
19
30
35class fit_error : public std::runtime_error
36{
37public:
38 fit_error(FitErrorCode code, const std::string &what) : std::runtime_error(what), errorCode(code) {}
39
40 [[nodiscard]] FitErrorCode code() const noexcept { return errorCode; }
41
42private:
43 FitErrorCode errorCode;
44};
45
46} // namespace randlib
The fit_error class Thrown when a distribution cannot be fitted to a sample; code() tells why.
Definition errors.hpp:36
FitErrorCode code() const noexcept
Definition errors.hpp:40
fit_error(FitErrorCode code, const std::string &what)
Definition errors.hpp:38
The not_implemented class Thrown when a quantity is not yet available for the given parameters,...
Definition errors.hpp:15
not_implemented(const std::string &what)
Definition errors.hpp:17
Definition bivariate_normal.hpp:10
FitErrorCode
Reason why a distribution could not be fitted to a sample.
Definition errors.hpp:22
@ WrongSample
the sample could not have been drawn from this distribution
@ WrongLevel
the significance level is not in (0, 1)
@ NotApplicable
the method cannot be applied to this distribution or sample
@ WrongReturn
the method returned invalid parameters
@ TooFewElements
the sample is too small
@ Undefined
any other failure