Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
FALCON-1969 Provide server-side error details on CLI, if any
Here is a sample CLI output for comparison.

Before:
_[ambari-qasandbox falcon-0.10-SNAPSHOT]$ bin/falcon extension -submit -extensionName hdfs-mirroring -file /tmp/falcon-xml/hdfs-mirror-para.txt
Hadoop is installed, adding hadoop classpath to falcon classpath
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/usr/hdp/2.4.0.0-169/falcon-0.10-SNAPSHOT/client/lib/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/usr/hdp/2.4.0.0-169/falcon-0.10-SNAPSHOT/client/lib/falcon-cli-0.10-SNAPSHOT.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/usr/hdp/2.4.0.0-169/hadoop/lib/slf4j-log4j12-1.7.10.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]
ERROR: Internal Server Error;_

After:
_[ambari-qasandbox falcon-0.10-SNAPSHOT]$ bin/falcon extension -submit -extensionName hdfs-mirroring -file /tmp/falcon-xml/hdfs-mirror-para.txt
Hadoop is installed, adding hadoop classpath to falcon classpath
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/usr/hdp/2.4.0.0-169/falcon-0.10-SNAPSHOT/client/lib/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/usr/hdp/2.4.0.0-169/falcon-0.10-SNAPSHOT/client/lib/falcon-cli-0.10-SNAPSHOT.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/usr/hdp/2.4.0.0-169/hadoop/lib/slf4j-log4j12-1.7.10.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]
ERROR: Internal Server Error;**Missing extension property: jobName**_

Author: yzheng-hortonworks <yzheng@hortonworks.com>

Reviewers: "Balu Vellanki <balu@apache.org>"

Closes #148 from yzheng-hortonworks/FALCON-1969 and squashes the following commits:

2956e89 [yzheng-hortonworks] show error details on CLI
7a76b4a [yzheng-hortonworks] FALCON-1969 Provide server-side error details on CLI, if any
  • Loading branch information
yzheng-hortonworks authored and bvellanki committed May 23, 2016
1 parent d59ff0d commit 004e612d48076b0e2022aeff5d01bb4bed4c8094
Showing 1 changed file with 12 additions and 14 deletions.
@@ -47,21 +47,19 @@ public static FalconCLIException fromReponse(ClientResponse clientResponse) {
ClientResponse.Status status = clientResponse.getClientResponseStatus();
String statusValue = status.toString();
String message = "";
if (status == ClientResponse.Status.BAD_REQUEST) {
clientResponse.bufferEntity();
InputStream in = clientResponse.getEntityInputStream();
clientResponse.bufferEntity();
InputStream in = clientResponse.getEntityInputStream();
try {
in.mark(MB);
message = clientResponse.getEntity(APIResult.class).getMessage();
} catch (Throwable th) {
byte[] data = new byte[MB];
try {
in.mark(MB);
message = clientResponse.getEntity(APIResult.class).getMessage();
} catch (Throwable th) {
byte[] data = new byte[MB];
try {
in.reset();
int len = in.read(data);
message = new String(data, 0, len);
} catch (IOException e) {
message = e.getMessage();
}
in.reset();
int len = in.read(data);
message = new String(data, 0, len);
} catch (IOException e) {
message = e.getMessage();
}
}
return new FalconCLIException(statusValue + ";" + message);

0 comments on commit 004e612

Please sign in to comment.