Propagate npm install error to front-end

This commit is contained in:
Lee moon soo 2017-01-16 10:13:45 -08:00
parent 7635c55cd7
commit b665588406
3 changed files with 14 additions and 19 deletions

View file

@ -144,9 +144,6 @@ public class HeliumRestApi {
} catch (IOException e) {
logger.error(e.getMessage(), e);
return new JsonResponse(Response.Status.INTERNAL_SERVER_ERROR, e.getMessage()).build();
} catch (TaskRunnerException e) {
logger.error(e.getMessage(), e);
return new JsonResponse(Response.Status.INTERNAL_SERVER_ERROR, e.getMessage()).build();
}
}
@ -159,9 +156,6 @@ public class HeliumRestApi {
} catch (IOException e) {
logger.error(e.getMessage(), e);
return new JsonResponse(Response.Status.INTERNAL_SERVER_ERROR, e.getMessage()).build();
} catch (TaskRunnerException e) {
logger.error(e.getMessage(), e);
return new JsonResponse(Response.Status.INTERNAL_SERVER_ERROR, e.getMessage()).build();
}
}
@ -180,7 +174,7 @@ public class HeliumRestApi {
try {
helium.setVisualizationPackageOrder(orderedList);
} catch (IOException | TaskRunnerException e) {
} catch (IOException e) {
logger.error(e.getMessage(), e);
return new JsonResponse(Response.Status.INTERNAL_SERVER_ERROR, e.getMessage()).build();
}

View file

@ -16,7 +16,6 @@
*/
package org.apache.zeppelin.helium;
import com.github.eirslett.maven.plugins.frontend.lib.TaskRunnerException;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import org.apache.commons.io.FileUtils;
@ -31,8 +30,6 @@ import org.slf4j.LoggerFactory;
import java.io.File;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.*;
/**
@ -54,7 +51,7 @@ public class Helium {
String defaultLocalRegistryPath,
HeliumVisualizationFactory visualizationFactory,
HeliumApplicationFactory applicationFactory)
throws IOException, TaskRunnerException {
throws IOException {
this.heliumConfPath = heliumConfPath;
this.defaultLocalRegistryPath = defaultLocalRegistryPath;
this.visualizationFactory = visualizationFactory;
@ -206,11 +203,11 @@ public class Helium {
return null;
}
public File recreateVisualizationBundle() throws IOException, TaskRunnerException {
public File recreateVisualizationBundle() throws IOException {
return visualizationFactory.bundle(getVisualizationPackagesToBundle(), true);
}
public void enable(String name, String artifact) throws IOException, TaskRunnerException {
public void enable(String name, String artifact) throws IOException {
HeliumPackageSearchResult pkgInfo = getPackageInfo(name, artifact);
// no package found.
@ -229,7 +226,7 @@ public class Helium {
save();
}
public void disable(String name) throws IOException, TaskRunnerException {
public void disable(String name) throws IOException {
String artifact = heliumConf.getEnabledPackages().get(name);
if (artifact == null) {
@ -344,7 +341,7 @@ public class Helium {
}
public void setVisualizationPackageOrder(List<String> orderedPackageList)
throws IOException, TaskRunnerException {
throws IOException {
heliumConf.setVisualizationDisplayOrder(orderedPackageList);
// if package is visualization, rebuild bundle

View file

@ -94,12 +94,12 @@ public class HeliumVisualizationFactory {
return new ProxyConfig(proxy);
}
public File bundle(List<HeliumPackage> pkgs) throws IOException, TaskRunnerException {
public File bundle(List<HeliumPackage> pkgs) throws IOException {
return bundle(pkgs, false);
}
public synchronized File bundle(List<HeliumPackage> pkgs, boolean forceRefresh)
throws IOException, TaskRunnerException {
throws IOException {
// package.json
URL pkgUrl = Resources.getResource("helium/package.json");
String pkgJson = Resources.toString(pkgUrl, Charsets.UTF_8);
@ -213,8 +213,12 @@ public class HeliumVisualizationFactory {
}
out.reset();
npmCommand("install");
npmCommand("run bundle");
try {
npmCommand("install");
npmCommand("run bundle");
} catch (TaskRunnerException e) {
throw new IOException(new String(out.toByteArray()));
}
File visBundleJs = new File(workingDirectory, "vis.bundle.js");
if (!visBundleJs.isFile()) {