Skip to content

Commit

Permalink
Add errorID to checkCustomConstraint method of TimeSeries
Browse files Browse the repository at this point in the history
  • Loading branch information
ehennestad committed Nov 8, 2024
1 parent b02f126 commit ff68c1b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions +file/fillCustomConstraint.m
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@
customConstraintStr = sprintf( [...
'function checkCustomConstraint(obj)\n', ...
' assert(~isempty(obj.timestamps) || ~isempty(obj.starting_time), ...\n', ...
' ''NWB:TimeSeries:TimeNotSpecified'', ...\n ', ...
' "''timestamps'' or ''starting_time'' must be specified")\n', ...
' if ~isempty(obj.starting_time)\n', ...
' assert(~isempty(obj.starting_time_rate), ...\n', ...
' ''NWB:TimeSeries:RateMissing'', ...\n', ...
' "''starting_time_rate'' must be specified when ''starting_time'' is specified")\n', ...
' end\n', ...
'end'] );
Expand Down
4 changes: 3 additions & 1 deletion +types/+core/TimeSeries.m
Original file line number Diff line number Diff line change
Expand Up @@ -418,9 +418,11 @@
%% CUSTOM CONSTRAINTS
function checkCustomConstraint(obj)
assert(~isempty(obj.timestamps) || ~isempty(obj.starting_time), ...
"'timestamps' or 'starting_time' must be specified")
'NWB:TimeSeries:TimeNotSpecified', ...
"'timestamps' or 'starting_time' must be specified")
if ~isempty(obj.starting_time)
assert(~isempty(obj.starting_time_rate), ...
'NWB:TimeSeries:RateMissing', ...
"'starting_time_rate' must be specified when 'starting_time' is specified")
end
end
Expand Down

0 comments on commit ff68c1b

Please sign in to comment.