From 8c4b7ac93c790bbc07c29358e49640f1036e6ef1 Mon Sep 17 00:00:00 2001 From: Danny Robson Date: Mon, 3 Dec 2018 15:33:14 +1100 Subject: [PATCH] except: add docstrings --- except.hpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/except.hpp b/except.hpp index 698594b3..286d4cdf 100644 --- a/except.hpp +++ b/except.hpp @@ -11,6 +11,12 @@ #include namespace cruft { + /// A base exception class for all cruft libraries. + /// + /// There is deliberately no `what` method as it's not always acceptable + /// to store a string that we can return a pointer to. Instead we rely on + /// the `describe` method to output to a std::ostream. The user can wrangle + /// that into a std::string if they need one. class error { public: virtual ~error () = default; @@ -18,5 +24,8 @@ namespace cruft { }; - std::ostream& operator<< (std::ostream &os, error const&); + /// Use `error::describe` to render the supplied error object to a + /// std::ostream. + std::ostream& + operator<< (std::ostream &os, error const&); } \ No newline at end of file