aboutsummaryrefslogtreecommitdiff
path: root/src/error-demo/error-demo.cc
diff options
context:
space:
mode:
authorBen Burdette <bburdette@gmail.com>2020-05-06 14:07:20 -0600
committerBen Burdette <bburdette@gmail.com>2020-05-06 14:07:20 -0600
commite76ad2e48a71aa9804311f4dfb34374a5295b3b6 (patch)
tree1f15bd925884c5353a456e5e622f81436ab4f3ba /src/error-demo/error-demo.cc
parent7ffb5efdbc943851d2ee9d0573dca3e96b9bd742 (diff)
implement SysError errno handling
Diffstat (limited to 'src/error-demo/error-demo.cc')
-rw-r--r--src/error-demo/error-demo.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/error-demo/error-demo.cc b/src/error-demo/error-demo.cc
index 82b03d71b..b1b313e32 100644
--- a/src/error-demo/error-demo.cc
+++ b/src/error-demo/error-demo.cc
@@ -35,6 +35,14 @@ int main()
logger->logEI(ei);
}
+ // SysError; picks up errno
+ try {
+ auto x = readFile(-1);
+ }
+ catch (Error &e) {
+ std::cout << "error: " << e.sname() << std::endl;
+ logError(e.info());
+ }
// For completeness sake, info through vomit levels.
// But this is maybe a heavy format for those.