Catch runtime exceptions (e.g. IllegalStateException) when using the arbitrary data reader/writer.

This commit is contained in:
CalDescent 2021-08-18 16:23:46 +01:00
parent 95e905a5ae
commit 029c038a49
3 changed files with 4 additions and 4 deletions

View File

@ -278,7 +278,7 @@ public class ArbitraryResource {
} catch (IOException | DataException e) {
LOGGER.info("Unable to create arbitrary data file: {}", e.getMessage());
throw ApiExceptionFactory.INSTANCE.createException(request, ApiError.REPOSITORY_ISSUE);
} catch (IllegalStateException e) {
} catch (RuntimeException e) {
LOGGER.info("Unable to create arbitrary data file: {}", e.getMessage());
throw ApiExceptionFactory.INSTANCE.createException(request, ApiError.INVALID_DATA);
}

View File

@ -112,7 +112,7 @@ public class WebsiteResource {
} catch (IOException | DataException e) {
LOGGER.info("Unable to create arbitrary data file: {}", e.getMessage());
throw ApiExceptionFactory.INSTANCE.createException(request, ApiError.REPOSITORY_ISSUE);
} catch (IllegalStateException e) {
} catch (RuntimeException e) {
LOGGER.info("Unable to create arbitrary data file: {}", e.getMessage());
throw ApiExceptionFactory.INSTANCE.createException(request, ApiError.INVALID_DATA);
}
@ -214,7 +214,7 @@ public class WebsiteResource {
} catch (IOException | DataException e) {
LOGGER.info("Unable to create arbitrary data file: {}", e.getMessage());
throw ApiExceptionFactory.INSTANCE.createException(request, ApiError.REPOSITORY_ISSUE);
} catch (IllegalStateException e) {
} catch (RuntimeException e) {
LOGGER.info("Unable to create arbitrary data file: {}", e.getMessage());
throw ApiExceptionFactory.INSTANCE.createException(request, ApiError.INVALID_DATA);
}

View File

@ -69,7 +69,7 @@ public class ArbitraryDataBuildManager implements Runnable {
this.removeFromQueue(resourceId);
LOGGER.info("Finished building {}", queueItem);
} catch (IOException | DataException e) {
} catch (IOException | DataException | RuntimeException e) {
LOGGER.info("Error building {}: {}", queueItem, e.getMessage());
// Something went wrong - so remove it from the queue, and add to failed builds list
queueItem.setFailed(true);