Commit 524d523e authored by Stan Hu's avatar Stan Hu

Only decode result body if it has content upon custom action failure

parent 6fd4f680
......@@ -116,7 +116,9 @@ module Action
def raise_unsuccessful!(result)
message = begin
body = JSON.parse(result.body)
body['message'] || Base64.decode64(body['result']) || NO_MESSAGE_TEXT
message = body['message']
message = Base64.decode64(body['result']) if !message && body['result'] && !body['result'].empty?
message ? message : NO_MESSAGE_TEXT
rescue JSON::ParserError
NO_MESSAGE_TEXT
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment