File tree 2 files changed +16
-3
lines changed
2 files changed +16
-3
lines changed Original file line number Diff line number Diff line change 4
4
// This source code is licensed under the BSD-style license found in the
5
5
// LICENSE file in the root directory of this source tree.
6
6
7
+ #pragma once
8
+
7
9
#ifndef MULTIPY_EXCEPTION_H
8
10
#define MULTIPY_EXCEPTION_H
9
11
10
12
#include < exception>
13
+ #include < stdexcept>
11
14
12
15
#define MULTIPY_INTERNAL_ASSERT_WITH_MESSAGE (condition, message ) \
13
16
if (!(condition)) { \
51
54
MULTIPY_CHECK_NO_MESSAGE(__VA_ARGS__));
52
55
53
56
#endif // MULTIPY_EXCEPTION_H
57
+
58
+ namespace torch {
59
+ namespace deploy {
60
+ class MultipyEmbeddedException : public std ::runtime_error {
61
+ public:
62
+ explicit MultipyEmbeddedException (const std::string& error)
63
+ : std::runtime_error(error) {}
64
+ };
65
+ } // namespace deploy
66
+ } // namespace torch
Original file line number Diff line number Diff line change @@ -92,17 +92,17 @@ class MultiPySafeRethrow {
92
92
auto code = err.value ().attr (" code" ).cast <int >();
93
93
std::exit (code);
94
94
}
95
- throw std::runtime_error (
95
+ throw torch::deploy::MultipyEmbeddedException (
96
96
std::string (file_) + " :" + std::to_string (line_) +
97
97
" : Exception Caught inside torch::deploy embedded library: \n " +
98
98
err.what ());
99
99
} catch (std::exception & err) {
100
- throw std::runtime_error (
100
+ throw torch::deploy::MultipyEmbeddedException (
101
101
std::string (file_) + " :" + std::to_string (line_) +
102
102
" : Exception Caught inside torch::deploy embedded library: \n " +
103
103
err.what ());
104
104
} catch (...) {
105
- throw std::runtime_error (
105
+ throw torch::deploy::MultipyEmbeddedException (
106
106
std::string (file_) + " :" + std::to_string (line_) +
107
107
" : Unknown Exception Caught inside torch::deploy embedded library" );
108
108
}
You can’t perform that action at this time.
0 commit comments