summaryrefslogtreecommitdiffstats
path: root/rust/src
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2019-01-10 16:10:06 -0800
committerBryan Newbold <bnewbold@robocracy.org>2019-01-10 16:10:06 -0800
commit12557cbdb5dee2d72b83514f390911e89fc6b172 (patch)
tree5dbf8d21663de4205548f1f0b0cc5151872a5d8e /rust/src
parent60d39b2f9923bf1b9d659f2f4dad223ec565466a (diff)
downloadfatcat-12557cbdb5dee2d72b83514f390911e89fc6b172.tar.gz
fatcat-12557cbdb5dee2d72b83514f390911e89fc6b172.zip
return error enum variant name (only)
Diffstat (limited to 'rust/src')
-rw-r--r--rust/src/errors.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/rust/src/errors.rs b/rust/src/errors.rs
index 95979534..19ba2f82 100644
--- a/rust/src/errors.rs
+++ b/rust/src/errors.rs
@@ -106,7 +106,8 @@ impl Into<models::ErrorResponse> for FatcatError {
// TODO: something more complex? context?
models::ErrorResponse {
success: false,
- error: self.name().unwrap_or("other").to_string(),
+ // enum variant name, without fields. whew, what a pile
+ error: format!("{:?}", self).split('(').collect::<Vec<&str>>()[0].to_string(),
message: self.to_string(),
}
}