diff options
| author | dawidg81 <dawidgorski.m@gmail.com> | 2026-01-28 15:57:02 +0100 |
|---|---|---|
| committer | dawidg81 <dawidgorski.m@gmail.com> | 2026-01-28 15:57:02 +0100 |
| commit | b6cedaabda62066964de227d808060bcf598160c (patch) | |
| tree | c2e067483ca2b0c94f822cc0c94ee8d529685a14 /src/Utils/catch.cpp | |
| parent | 50df44ec3d4569b1c697e6b3545097546622dd2c (diff) | |
| parent | b215fe5e498b7e7ea385a2b07797d047a6529a38 (diff) | |
Merge branch 'main' of https://github.com/dawidg81/minesweeper
Diffstat (limited to 'src/Utils/catch.cpp')
| -rw-r--r-- | src/Utils/catch.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/Utils/catch.cpp b/src/Utils/catch.cpp new file mode 100644 index 0000000..37ebefe --- /dev/null +++ b/src/Utils/catch.cpp @@ -0,0 +1,22 @@ +#include "Utils.hpp" + +#include <iostream> +#include <ostream> + +int Utils::catchInputInt(int* input){ + std::cin >> input; + + if (std::cin.fail()) { + std::cout << "error: Input failed" << std::endl; + return 1; + } + + return 0; +} + +int Utils::catchReturn(int renum){ + if (renum != 0) { + std::cout << "Received error signal, sending further" << std::endl; + } + return 0; +} |
