From cd38c4598c55060be1425cad429b23a3f1a6574c Mon Sep 17 00:00:00 2001 From: Jyri Sarha Date: Tue, 29 Sep 2015 12:15:29 +0300 Subject: Proper exception strings to Card::Card() --- libkms++/card.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/libkms++/card.cpp b/libkms++/card.cpp index 3dea542..626c424 100644 --- a/libkms++/card.cpp +++ b/libkms++/card.cpp @@ -26,7 +26,8 @@ Card::Card() int fd = open(card, O_RDWR | O_CLOEXEC); if (fd < 0) - throw invalid_argument("foo"); + throw invalid_argument((string(strerror(errno)) + + " opening " + card).c_str()); m_fd = fd; int r; @@ -36,7 +37,7 @@ Card::Card() r = drmSetClientCap(m_fd, DRM_CLIENT_CAP_UNIVERSAL_PLANES, 1); if (r) - throw invalid_argument("foo"); + throw invalid_argument("Can't set universal planes"); r = drmSetClientCap(m_fd, DRM_CLIENT_CAP_ATOMIC, 1); m_has_atomic = r == 0; @@ -44,11 +45,11 @@ Card::Card() uint64_t has_dumb; r = drmGetCap(fd, DRM_CAP_DUMB_BUFFER, &has_dumb); if (r || !has_dumb) - throw invalid_argument("foo"); + throw invalid_argument("Dumb buffers not available"); auto res = drmModeGetResources(m_fd); if (!res) - throw invalid_argument("foo"); + throw invalid_argument("Can't get card resources"); for (int i = 0; i < res->count_connectors; ++i) { uint32_t id = res->connectors[i]; -- cgit v1.2.3