File tree Expand file tree Collapse file tree
cpp/src/dotcpp/dot/system Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -25,10 +25,12 @@ limitations under the License.
2525
2626#include < dot/declare.hpp>
2727#include < dot/detail/reference_counter.hpp>
28+ #include < dot/system/exception.hpp>
2829
2930namespace dot
3031{
3132 class Null ;
33+ class exception ;
3234
3335 // / <summary>
3436 // / Reference counted smart pointer based on std::shared_ptr
@@ -148,7 +150,8 @@ namespace dot
148150 T* p = dynamic_cast <T*>(rhs.ptr_ );
149151
150152 // Check that dynamic cast succeeded
151- if (!p) throw std::runtime_error (" Cast cannot be performed." ); // TODO Use typeof(...) and type() to provide specific types in the error message
153+ if (!p)
154+ throw dot::exception (" Cast cannot be performed." ); // TODO Use typeof(...) and type() to provide specific types in the error message
152155
153156 // Current pointer now contains the result of dynamic_cast
154157 ptr_ = p;
@@ -164,13 +167,13 @@ namespace dot
164167 template <class T > T& ptr<T>::operator *() const
165168 {
166169 if (!ptr_)
167- throw std::runtime_error (" Pointer is not initialized" );
170+ throw std::exception (" Pointer is not initialized" );
168171 return *ptr_;
169172 }
170173 template <class T > T* ptr<T>::operator ->() const
171174 {
172175 if (!ptr_)
173- throw std::runtime_error (" Pointer is not initialized" );
176+ throw std::exception (" Pointer is not initialized" );
174177 return ptr_;
175178 }
176179 template <class T > bool ptr<T>::operator ==(const ptr<T>& rhs) const { return ptr_ == rhs.ptr_ ; } // TODO check when comparison is performed by value
You can’t perform that action at this time.
0 commit comments