|
1 | 1 | package edu.kit.datamanager.semplugin; |
2 | 2 |
|
| 3 | +import edu.kit.datamanager.mappingservice.exception.PluginInitializationFailedException; |
3 | 4 | import edu.kit.datamanager.mappingservice.plugins.*; |
4 | 5 | import edu.kit.datamanager.mappingservice.util.*; |
5 | 6 | import org.slf4j.Logger; |
@@ -53,7 +54,7 @@ public SEMImagePlugin() { |
53 | 54 | } |
54 | 55 |
|
55 | 56 | } catch (IOException e) { |
56 | | - e.printStackTrace(); |
| 57 | + throw new PluginInitializationFailedException("Failed to instantiate plugin class.", e); |
57 | 58 | } |
58 | 59 | } |
59 | 60 |
|
@@ -95,18 +96,15 @@ public void setup() { |
95 | 96 | LOGGER.info("Cloning git repository {}, Tag {}", REPOSITORY, TAG); |
96 | 97 | dir = FileUtil.cloneGitRepository(REPOSITORY, TAG); |
97 | 98 | // Install Python dependencies |
98 | | - |
99 | 99 | MappingPluginState venvState = PythonRunnerUtil.runPythonScript("-m", "venv", "--system-site-packages", dir + "/" + pluginVenv); |
100 | 100 | if (MappingPluginState.SUCCESS().getState().equals(venvState.getState())) { |
101 | | - LOGGER.info("Venv for plugin installed successfully."); |
102 | | - LOGGER.info("Installing packages"); |
| 101 | + LOGGER.info("Venv for plugin installed successfully. Installing packages."); |
103 | 102 | ShellRunnerUtil.run(dir + "/" + venvInterpreter, "-m", "pip", "install", "-r", dir + "/" + "requirements.dist.txt"); |
104 | 103 | } else { |
105 | | - LOGGER.error("venv installation was not successful"); |
| 104 | + throw new PluginInitializationFailedException("Venv installation was not successful. Status: " + venvState.getState()); |
106 | 105 | } |
107 | | - |
108 | | - } catch (Exception e) { |
109 | | - e.printStackTrace(); |
| 106 | + } catch (MappingPluginException e) { |
| 107 | + throw new PluginInitializationFailedException("Unexpected error during plugin setup.", e); |
110 | 108 | } |
111 | 109 | } |
112 | 110 |
|
|
0 commit comments