Skip to content

Commit e8c3c6a

Browse files
authored
Add Z reporting to error messages (#90)
* shortened python line * clang-format changes * pre-commit chanes
1 parent b6f5c2a commit e8c3c6a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+99
-80
lines changed

docs/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
astroid==3.3.11
12
sphinx
23
sphinx-autoapi
34
sphinx_rtd_theme

src/chemcache/atoms/Z_from_sym.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ MODULE_RUN(Z_from_sym) {
286286
} else if(sym == "Og") {
287287
Z = 118;
288288
} else {
289-
throw std::out_of_range("Z not available for Symbol");
289+
throw std::out_of_range("Z not available for Symbol: " + sym);
290290
}
291291

292292
auto rv = results();

src/chemcache/atoms/atoms_average.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ MODULE_CTOR(atoms_average) {
4646
MODULE_RUN(atoms_average) {
4747
const auto& [Z] = atom_pt::unwrap_inputs(inputs);
4848
auto rv = results();
49+
auto z_string = std::to_string(Z);
4950

5051
switch(Z) {
5152
case(0): {
@@ -525,7 +526,7 @@ MODULE_RUN(atoms_average) {
525526
return atom_pt::wrap_results(rv, atom);
526527
}
527528
default: {
528-
throw std::out_of_range("Atom not available for Z");
529+
throw std::out_of_range("Atom not available for Z: " + z_string);
529530
}
530531
}
531532
}

src/chemcache/atoms/atoms_isotope.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,11 @@ MODULE_RUN(atoms_isotope) {
4949
auto rv = results();
5050

5151
auto [Z, N] = Z_and_N;
52-
auto message1 = "Isotopes not available for Z";
53-
auto message2 = "Isotope not available for Z and mass number";
52+
auto z_string = std::to_string(Z);
53+
auto n_string = std::to_string(N);
54+
auto message1 = "Isotopes not available for Z: " + z_string;
55+
auto message2 = "Isotope not available for Z and mass number: (" +
56+
z_string + ", " + n_string + ")";
5457
atom_t atom;
5558
if(Z == 1) {
5659
if(N == 1) {

src/chemcache/atoms/sym_from_Z.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ MODULE_CTOR(sym_from_Z) {
4545

4646
MODULE_RUN(sym_from_Z) {
4747
const auto& [Z] = sym_pt::unwrap_inputs(inputs);
48+
auto z_string = std::to_string(Z);
4849

4950
sym_t sym;
5051
if(Z == 0) {
@@ -286,7 +287,7 @@ MODULE_RUN(sym_from_Z) {
286287
} else if(Z == 118) {
287288
sym = "Og";
288289
} else {
289-
throw std::out_of_range("Symbol not available for Z");
290+
throw std::out_of_range("Symbol not available for Z: " + z_string);
290291
}
291292

292293
auto rv = results();

src/chemcache/bases/bases.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2022 NWChemEx-Project
2+
* Copyright 2025 NWChemEx-Project
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.

src/chemcache/bases/sto_dash_3g/sto_dash_3g.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2022 NWChemEx-Project
2+
* Copyright 2025 NWChemEx-Project
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -217,7 +217,8 @@ MODULE_RUN(sto_dash_3g_atom_basis) {
217217
return atomic_basis_pt::wrap_results(rv, sto_dash_3g_54());
218218
}
219219
default: {
220-
throw std::out_of_range("Basis Set not available for Z");
220+
throw std::out_of_range("Basis Set not available for Z: " +
221+
std::to_string(Z));
221222
}
222223
}
223224
}

src/chemcache/bases/sto_dash_3g/sto_dash_3g.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#pragma once
22
#include <simde/types.hpp>
33
/*
4-
* Copyright 2022 NWChemEx-Project
4+
* Copyright 2025 NWChemEx-Project
55
*
66
* Licensed under the Apache License, Version 2.0 (the "License");
77
* you may not use this file except in compliance with the License.

src/chemcache/bases/sto_dash_3g/sto_dash_3g_1.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2022 NWChemEx-Project
2+
* Copyright 2025 NWChemEx-Project
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.

src/chemcache/bases/sto_dash_3g/sto_dash_3g_10.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2022 NWChemEx-Project
2+
* Copyright 2025 NWChemEx-Project
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.

0 commit comments

Comments
 (0)