Skip to content

Commit

Permalink
Fixed issue where the exception message was missing when the error re…
Browse files Browse the repository at this point in the history
…sponse has the 'error' attribute populated with the message instead of the 'message' attribute. (#408)
  • Loading branch information
ajoymajumdar authored Sep 18, 2020
1 parent dbb987d commit 72ad793
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
package com.netflix.metacat.client.module;

import com.fasterxml.jackson.databind.node.ObjectNode;
import com.google.common.base.Strings;
import com.netflix.metacat.common.exception.MetacatAlreadyExistsException;
import com.netflix.metacat.common.exception.MetacatBadRequestException;
import com.netflix.metacat.common.exception.MetacatException;
Expand Down Expand Up @@ -55,7 +56,10 @@ public Exception decode(final String methodKey, final Response response) {
message = Util.toString(response.body().asReader());
try {
final ObjectNode body = metacatJson.parseJsonObject(message);
message = body.path("message").asText("No error message supplied.");
message = body.path("error").asText();
if (Strings.isNullOrEmpty(message)) {
message = body.path("message").asText("No error message supplied.");
}
} catch (final MetacatJsonException ignored) {
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,12 @@

package com.netflix.metacat.common.server.connectors.exception;

import com.netflix.metacat.common.QualifiedName;

/**
* Invalid BusinessMetadata Exception.
* @author zhenl
* @since 1.2.0
*/
public class InvalidMetadataException extends ConnectorException {
private QualifiedName name;
/**
* Constructor.
*
Expand Down

0 comments on commit 72ad793

Please sign in to comment.