File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ // Copyright 2021 Open Source Robotics Foundation, Inc.
2+ //
3+ // Licensed under the Apache License, Version 2.0 (the "License");
4+ // you may not use this file except in compliance with the License.
5+ // You may obtain a copy of the License at
6+ //
7+ // http://www.apache.org/licenses/LICENSE-2.0
8+ //
9+ // Unless required by applicable law or agreed to in writing, software
10+ // distributed under the License is distributed on an "AS IS" BASIS,
11+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+ // See the License for the specific language governing permissions and
13+ // limitations under the License.
14+
15+ #include " exceptions.hpp"
16+
17+ #include < rcl/error_handling.h>
18+
19+ #include < stdexcept>
20+ #include < string>
21+
22+ namespace rclpy
23+ {
24+ std::string append_rcl_error (std::string prepend)
25+ {
26+ prepend += " : " ;
27+ prepend += rcl_get_error_string ().str ;
28+ rcl_reset_error ();
29+ return prepend;
30+ }
31+
32+ RCLError::RCLError (const std::string & error_text)
33+ : std::runtime_error(append_rcl_error(error_text))
34+ {
35+ }
36+ } // namespace rclpy
Original file line number Diff line number Diff line change 1515#ifndef RCLPY__EXCEPTIONS_HPP_
1616#define RCLPY__EXCEPTIONS_HPP_
1717
18- #include < rcl/error_handling.h>
19-
2018#include < stdexcept>
2119#include < string>
2220
2321namespace rclpy
2422{
2523
26- std::string append_rcl_error (std::string prepend)
27- {
28- prepend += " : " ;
29- prepend += rcl_get_error_string ().str ;
30- rcl_reset_error ();
31- return prepend;
32- }
24+ std::string append_rcl_error (std::string prepend);
3325
3426class RCLError : public std ::runtime_error
3527{
3628public:
37- explicit RCLError (const std::string & error_text)
38- : std::runtime_error(append_rcl_error(error_text))
39- {
40- }
29+ explicit RCLError (const std::string & error_text);
4130
4231 ~RCLError () = default ;
4332};
You can’t perform that action at this time.
0 commit comments