// packages.
List<Map<String, Object>> layers = extractBuildLayers(buildDetails, packageIds);
// Instantiate new build request with user parameters, catch construction exceptions
// and throw extended WebApplicationException.
BuildRequest buildRequest;
try {
buildRequest = new BuildRequest(packages, cdn, optimise, cssOptimise, platforms, themes, layers);
logger.log(Level.INFO, String.format(newBuildRequestLogMsg, buildRequest.serialise()));
} catch (JsonMappingException e) {
logFatalBuildRequest(buildDetails, e);
throw new IncorrectParameterException(layersParsingErrorText);
} catch (JsonParseException e) {
logFatalBuildRequest(buildDetails, e);