Line data Source code
1 : // SPDX-License-Identifier: BSD-3-Clause 2 : // Copyright (c) 2023 Scipp contributors (https://github.com/scipp) 3 : /// @file 4 : /// @author Jan-Lukas Wynen 5 : #include "scipp/units/except.h" 6 : 7 : namespace scipp::except { 8 293 : UnitError::UnitError(const std::string &msg) : Error{msg} {} 9 : 10 : template <> 11 65 : void throw_mismatch_error(const units::Unit &expected, 12 : const units::Unit &actual, 13 : const std::string &optional_message) { 14 195 : throw UnitError("Expected unit " + to_string(expected) + ", got " + 15 260 : to_string(actual) + '.' + optional_message); 16 : } 17 : } // namespace scipp::except