File tree Expand file tree Collapse file tree 2 files changed +16
-3
lines changed
Expand file tree Collapse file tree 2 files changed +16
-3
lines changed Original file line number Diff line number Diff line change 44// This source code is licensed under the BSD-style license found in the
55// LICENSE file in the root directory of this source tree.
66
7+ #pragma once
8+
79#ifndef MULTIPY_EXCEPTION_H
810#define MULTIPY_EXCEPTION_H
911
1012#include < exception>
13+ #include < stdexcept>
1114
1215#define MULTIPY_INTERNAL_ASSERT_WITH_MESSAGE (condition, message ) \
1316 if (!(condition)) { \
5154 MULTIPY_CHECK_NO_MESSAGE(__VA_ARGS__));
5255
5356#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 {
9292 auto code = err.value ().attr (" code" ).cast <int >();
9393 std::exit (code);
9494 }
95- throw std::runtime_error (
95+ throw torch::deploy::MultipyEmbeddedException (
9696 std::string (file_) + " :" + std::to_string (line_) +
9797 " : Exception Caught inside torch::deploy embedded library: \n " +
9898 err.what ());
9999 } catch (std::exception& err) {
100- throw std::runtime_error (
100+ throw torch::deploy::MultipyEmbeddedException (
101101 std::string (file_) + " :" + std::to_string (line_) +
102102 " : Exception Caught inside torch::deploy embedded library: \n " +
103103 err.what ());
104104 } catch (...) {
105- throw std::runtime_error (
105+ throw torch::deploy::MultipyEmbeddedException (
106106 std::string (file_) + " :" + std::to_string (line_) +
107107 " : Unknown Exception Caught inside torch::deploy embedded library" );
108108 }
You can’t perform that action at this time.
0 commit comments