From e023c0b1101942a51494f4a340c1b1a5bd4f2636 Mon Sep 17 00:00:00 2001 From: Eric Berquist Date: Sat, 2 Mar 2024 12:16:28 -0700 Subject: [PATCH] Doxygen for UnitAlgebra exceptions (#1048) --- src/sst/core/unitAlgebra.h | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/sst/core/unitAlgebra.h b/src/sst/core/unitAlgebra.h index a23582f8f..db9233f34 100644 --- a/src/sst/core/unitAlgebra.h +++ b/src/sst/core/unitAlgebra.h @@ -256,27 +256,53 @@ class UnitAlgebra : ImplementSerializable(SST::UnitAlgebra) public: + /** Base exception for all exception classes in UnitAlgebra + * + * This exception inherits from std::logic_error, as all exceptions + * thrown in UnitAlgebra are considered configuration errors occurring + * prior to simulation start, rather than runtime errors. + */ class UnitAlgebraException : public std::logic_error { public: + /** + * @param msg exception message displayed as-is without modification + */ UnitAlgebraException(const std::string& msg); }; + /** Exception for when units are not recognized or are invalid + */ class InvalidUnitType : public UnitAlgebraException { public: + /** + * @param type string containing invalid type + */ InvalidUnitType(const std::string& type); }; + /** Exception for when number couldn't be parsed + */ class InvalidNumberString : public UnitAlgebraException { public: + /** + * @param number string containing invalid number + */ InvalidNumberString(const std::string& number); }; + /** Exception for when attempting operations between objects that do not have matching base units + */ class NonMatchingUnits : public UnitAlgebraException { public: + /** + * @param lhs units for UnitAlgebra on left-hand side of operation + * @param rhs units for UnitAlgebra on right-hand side of operation + * @param operation representation of operation attempted between units + */ NonMatchingUnits(const std::string& lhs, const std::string& rhs, const std::string& operation); }; };