Merge pull request #140 from mprasil/error_format

Update the error format to show message in new Vault
This commit is contained in:
Daniel García 2018-08-16 00:52:46 +02:00 committed by GitHub
commit 6fdeeb56ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,19 +3,20 @@
///
#[macro_export]
macro_rules! err {
($err:expr, $err_desc:expr, $msg:expr) => {{
($err:expr, $msg:expr) => {{
println!("ERROR: {}", $msg);
err_json!(json!({
"error": $err,
"error_description": $err_desc,
"ErrorModel": {
"Message": $msg,
"ValidationErrors": null,
"Object": "error"
}
"Message": $err,
"ValidationErrors": {
"": [$msg,],
},
"ExceptionMessage": null,
"ExceptionStackTrace": null,
"InnerExceptionMessage": null,
"Object": "error",
}))
}};
($msg:expr) => { err!("default_error", "default_error_description", $msg) }
($msg:expr) => { err!("The model state is invalid", $msg) }
}
#[macro_export]