Skip to content

Commit aaf292c

Browse files
committed
Improved error messages. If the exception was a WebApplicationException and didn't carry any message, the error message in the status output would read something along the lines of "Error message empty" because there wasn't any message provided to the BPMN error that is thrown if downloadResult contains an error message
1 parent a899b71 commit aaf292c

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

src/main/java/dev/dsf/bpe/util/BinaryResourceDownloader.java

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import dev.dsf.bpe.util.logging.PingPongLogger;
1212
import dev.dsf.bpe.v1.ProcessPluginApi;
1313
import dev.dsf.bpe.v1.variables.Variables;
14+
import jakarta.ws.rs.WebApplicationException;
1415

1516
public class BinaryResourceDownloader
1617
{
@@ -60,14 +61,23 @@ public DownloadResult download(Variables variables, ProcessPluginApi api, Task t
6061
}
6162
catch (IOException e)
6263
{
63-
logger.error("Encountered an error while downloading resource: {}", e.getMessage());
64-
downloadResult = new DownloadResult(e.getMessage());
64+
String error = "Encountered an error while downloading resource: " + e.getMessage();
65+
logger.error(error);
66+
downloadResult = new DownloadResult(error);
6567
}
6668
}
69+
catch (WebApplicationException e)
70+
{
71+
String error = "Encountered an error while trying to download resource: "
72+
+ e.getResponse().getStatusInfo().getStatusCode() + " " + e.getMessage();
73+
logger.error(error);
74+
downloadResult = new DownloadResult(error);
75+
}
6776
catch (Exception e)
6877
{
69-
logger.error("Encountered an error while trying to download resource: {}", e.getMessage());
70-
downloadResult = new DownloadResult(e.getMessage());
78+
String error = "Encountered an error while trying to download resource: " + e.getMessage();
79+
logger.error(error);
80+
downloadResult = new DownloadResult(error);
7181
}
7282
return downloadResult;
7383
}

0 commit comments

Comments
 (0)