From 4970a2aee51f9839b7fbbc140efc2c5be1ca46b1 Mon Sep 17 00:00:00 2001
From: Adrien Beraud <adrien.beraud@savoirfairelinux.com>
Date: Wed, 5 Apr 2017 18:15:02 +0200
Subject: [PATCH] infohash: throw exception with error message

---
 src/infohash.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/infohash.cpp b/src/infohash.cpp
index fcc6441b..f25fd5ea 100644
--- a/src/infohash.cpp
+++ b/src/infohash.cpp
@@ -57,7 +57,7 @@ InfoHash::get(const uint8_t* data, size_t data_len)
     int rc = gnutls_fingerprint(algo, &gnudata, h.data(), &s);
     if (rc == 0 && s == HASH_LEN)
         return h;
-    throw std::string("Error while hashing");
+    throw std::runtime_error(std::string("Error hashing: ") + gnutls_strerror(rc));
 }
 
 InfoHash
-- 
GitLab