diff --git a/util-split.R b/util-split.R index cdbf00bf..a8c26ad9 100644 --- a/util-split.R +++ b/util-split.R @@ -18,7 +18,7 @@ ## Copyright 2020 by Christian Hechtl ## Copyright 2017 by Felix Prasse ## Copyright 2017-2018 by Thomas Bock -## Copyright 2020 by Thomas Bock +## Copyright 2020, 2024 by Thomas Bock ## Copyright 2021 by Niklas Schneider ## Copyright 2021 by Johannes Hostert ## Copyright 2022 by Jonathan Baumann @@ -135,7 +135,7 @@ split.data.by.bins = function(project.data, activity.amount, bins, split.basis = #' and the last range ends with the last timestamp. #' #' If timestamps are not provided, the custom event timestamps in \code{project.data} are -#' used instead. +#' used instead. If no custom event timestamps are available in \code{project.data}, an error is thrown. #' #' @param project.data the *Data object from which the data is retrieved #' @param bins a vector of timestamps [default: NULL] @@ -148,6 +148,12 @@ split.data.time.based.by.timestamps = function(project.data, bins = NULL, projec if (is.null(bins)) { # bins were not provided, use custom timestamps from project bins = unlist(project.data$get.custom.event.timestamps()) + + if (is.null(bins)) { # stop if no custom timestamps are available + logging::logerror("There are no custom timestamps available for splitting (configured file: %s).", + project.data$get.project.conf.entry("custom.event.timestamps.file")) + stop("Stopping due to missing data.") + } } return (split.data.time.based(project.data, bins = bins, project.conf.new));