summaryrefslogtreecommitdiff
path: root/openssl/src/error.rs
diff options
context:
space:
mode:
authorSteven Fackler <sfackler@palantir.com>2018-02-27 15:55:03 -0800
committerSteven Fackler <sfackler@palantir.com>2018-02-27 15:56:23 -0800
commit85d8db21d2e7617ade950e9cd4da64ec887671d4 (patch)
treeb30b076dc89a7e6b67e9f763c9d376a0b18da75c /openssl/src/error.rs
parent42ec251b552fdeb1c0b005445b4bba05127b13e4 (diff)
downloadrust-openssl-85d8db21d2e7617ade950e9cd4da64ec887671d4.zip
Always include something in ErrorStack's Display
The error stack can be empty after a some kinds of errors (AEAD validation failure in Crypter is one example), and we don't want to display as an empty string in that case.
Diffstat (limited to 'openssl/src/error.rs')
-rw-r--r--openssl/src/error.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/openssl/src/error.rs b/openssl/src/error.rs
index 7f3d472e..1ddd0f50 100644
--- a/openssl/src/error.rs
+++ b/openssl/src/error.rs
@@ -59,6 +59,10 @@ impl ErrorStack {
impl fmt::Display for ErrorStack {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
+ if self.0.is_empty() {
+ return fmt.write_str("OpenSSL error");
+ }
+
let mut first = true;
for err in &self.0 {
if !first {