Skip to content

Commit

Permalink
Add errorIDs to class generators and update regenerate types with err…
Browse files Browse the repository at this point in the history
…orIDs
  • Loading branch information
ehennestad committed Nov 5, 2024
1 parent eaa51ba commit b02f126
Show file tree
Hide file tree
Showing 18 changed files with 23 additions and 24 deletions.
5 changes: 2 additions & 3 deletions +file/fillValidators.m
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@
' return;'...
'end'...
'if ~istable(val) && ~isstruct(val) && ~isa(val, ''containers.Map'')'...
[' error(''Property `' name '` must be a table,struct, or containers.Map.'');']...
[' error(''NWB:Type:InvalidPropertyType'', ''Property `' name '` must be a table, struct, or containers.Map.'');']...
'end'...
'vprops = struct();'...
}, newline);
Expand Down Expand Up @@ -294,8 +294,7 @@

classNameSplit = strsplit(className, '.');
shortName = classNameSplit{end};

errorStr = sprintf( 'error(''Unable to set the ''''%s'''' property of class ''''<a href="matlab:doc %s">%s</a>'''' because it is read-only.'')', name, className, shortName);
errorStr = sprintf( 'error(''NWB:Type:ReadOnlyProperty'', ''Unable to set the ''''%s'''' property of class ''''<a href="matlab:doc %s">%s</a>'''' because it is read-only.'')', name, className, shortName);

if ischar(value)
condition = strjoin({ ...
Expand Down
4 changes: 2 additions & 2 deletions +types/+core/AnnotationSeries.m
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,14 @@
if isequal(val, -1)
val = -1;
else
error('Unable to set the ''data_resolution'' property of class ''<a href="matlab:doc types.core.AnnotationSeries">AnnotationSeries</a>'' because it is read-only.')
error('NWB:Type:ReadOnlyProperty', 'Unable to set the ''data_resolution'' property of class ''<a href="matlab:doc types.core.AnnotationSeries">AnnotationSeries</a>'' because it is read-only.')
end
end
function val = validate_data_unit(obj, val)
if isequal(val, 'n/a')
val = 'n/a';
else
error('Unable to set the ''data_unit'' property of class ''<a href="matlab:doc types.core.AnnotationSeries">AnnotationSeries</a>'' because it is read-only.')
error('NWB:Type:ReadOnlyProperty', 'Unable to set the ''data_unit'' property of class ''<a href="matlab:doc types.core.AnnotationSeries">AnnotationSeries</a>'' because it is read-only.')
end
end
%% EXPORT
Expand Down
2 changes: 1 addition & 1 deletion +types/+core/CurrentClampSeries.m
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
if isequal(val, 'volts')
val = 'volts';
else
error('Unable to set the ''data_unit'' property of class ''<a href="matlab:doc types.core.CurrentClampSeries">CurrentClampSeries</a>'' because it is read-only.')
error('NWB:Type:ReadOnlyProperty', 'Unable to set the ''data_unit'' property of class ''<a href="matlab:doc types.core.CurrentClampSeries">CurrentClampSeries</a>'' because it is read-only.')
end
end
%% EXPORT
Expand Down
2 changes: 1 addition & 1 deletion +types/+core/CurrentClampStimulusSeries.m
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
if isequal(val, 'amperes')
val = 'amperes';
else
error('Unable to set the ''data_unit'' property of class ''<a href="matlab:doc types.core.CurrentClampStimulusSeries">CurrentClampStimulusSeries</a>'' because it is read-only.')
error('NWB:Type:ReadOnlyProperty', 'Unable to set the ''data_unit'' property of class ''<a href="matlab:doc types.core.CurrentClampStimulusSeries">CurrentClampStimulusSeries</a>'' because it is read-only.')
end
end
%% EXPORT
Expand Down
2 changes: 1 addition & 1 deletion +types/+core/ElectricalSeries.m
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
if isequal(val, 'volts')
val = 'volts';
else
error('Unable to set the ''data_unit'' property of class ''<a href="matlab:doc types.core.ElectricalSeries">ElectricalSeries</a>'' because it is read-only.')
error('NWB:Type:ReadOnlyProperty', 'Unable to set the ''data_unit'' property of class ''<a href="matlab:doc types.core.ElectricalSeries">ElectricalSeries</a>'' because it is read-only.')
end
end
function val = validate_electrodes(obj, val)
Expand Down
2 changes: 1 addition & 1 deletion +types/+core/ElectrodeGroup.m
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
return;
end
if ~istable(val) && ~isstruct(val) && ~isa(val, 'containers.Map')
error('Property `position` must be a table,struct, or containers.Map.');
error('NWB:Type:InvalidPropertyType', 'Property `position` must be a table, struct, or containers.Map.');
end
vprops = struct();
vprops.x = 'single';
Expand Down
2 changes: 1 addition & 1 deletion +types/+core/IZeroClampSeries.m
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
if isequal(val, 'N/A')
val = 'N/A';
else
error('Unable to set the ''stimulus_description'' property of class ''<a href="matlab:doc types.core.IZeroClampSeries">IZeroClampSeries</a>'' because it is read-only.')
error('NWB:Type:ReadOnlyProperty', 'Unable to set the ''stimulus_description'' property of class ''<a href="matlab:doc types.core.IZeroClampSeries">IZeroClampSeries</a>'' because it is read-only.')
end
end
%% EXPORT
Expand Down
2 changes: 1 addition & 1 deletion +types/+core/IndexSeries.m
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@
if isequal(val, 'N/A')
val = 'N/A';
else
error('Unable to set the ''data_unit'' property of class ''<a href="matlab:doc types.core.IndexSeries">IndexSeries</a>'' because it is read-only.')
error('NWB:Type:ReadOnlyProperty', 'Unable to set the ''data_unit'' property of class ''<a href="matlab:doc types.core.IndexSeries">IndexSeries</a>'' because it is read-only.')
end
end
function val = validate_indexed_images(obj, val)
Expand Down
4 changes: 2 additions & 2 deletions +types/+core/IntervalSeries.m
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,14 @@
if isequal(val, -1)
val = -1;
else
error('Unable to set the ''data_resolution'' property of class ''<a href="matlab:doc types.core.IntervalSeries">IntervalSeries</a>'' because it is read-only.')
error('NWB:Type:ReadOnlyProperty', 'Unable to set the ''data_resolution'' property of class ''<a href="matlab:doc types.core.IntervalSeries">IntervalSeries</a>'' because it is read-only.')
end
end
function val = validate_data_unit(obj, val)
if isequal(val, 'n/a')
val = 'n/a';
else
error('Unable to set the ''data_unit'' property of class ''<a href="matlab:doc types.core.IntervalSeries">IntervalSeries</a>'' because it is read-only.')
error('NWB:Type:ReadOnlyProperty', 'Unable to set the ''data_unit'' property of class ''<a href="matlab:doc types.core.IntervalSeries">IntervalSeries</a>'' because it is read-only.')
end
end
%% EXPORT
Expand Down
2 changes: 1 addition & 1 deletion +types/+core/IntracellularElectrodesTable.m
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
if isequal(val, 'Table for storing intracellular electrode related metadata.')
val = 'Table for storing intracellular electrode related metadata.';
else
error('Unable to set the ''description'' property of class ''<a href="matlab:doc types.core.IntracellularElectrodesTable">IntracellularElectrodesTable</a>'' because it is read-only.')
error('NWB:Type:ReadOnlyProperty', 'Unable to set the ''description'' property of class ''<a href="matlab:doc types.core.IntracellularElectrodesTable">IntracellularElectrodesTable</a>'' because it is read-only.')
end
end
function val = validate_electrode(obj, val)
Expand Down
2 changes: 1 addition & 1 deletion +types/+core/IntracellularRecordingsTable.m
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
if isequal(val, 'A table to group together a stimulus and response from a single electrode and a single simultaneous recording and for storing metadata about the intracellular recording.')
val = 'A table to group together a stimulus and response from a single electrode and a single simultaneous recording and for storing metadata about the intracellular recording.';
else
error('Unable to set the ''description'' property of class ''<a href="matlab:doc types.core.IntracellularRecordingsTable">IntracellularRecordingsTable</a>'' because it is read-only.')
error('NWB:Type:ReadOnlyProperty', 'Unable to set the ''description'' property of class ''<a href="matlab:doc types.core.IntracellularRecordingsTable">IntracellularRecordingsTable</a>'' because it is read-only.')
end
end
function val = validate_electrodes(obj, val)
Expand Down
2 changes: 1 addition & 1 deletion +types/+core/IntracellularResponsesTable.m
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
if isequal(val, 'Table for storing intracellular response related metadata.')
val = 'Table for storing intracellular response related metadata.';
else
error('Unable to set the ''description'' property of class ''<a href="matlab:doc types.core.IntracellularResponsesTable">IntracellularResponsesTable</a>'' because it is read-only.')
error('NWB:Type:ReadOnlyProperty', 'Unable to set the ''description'' property of class ''<a href="matlab:doc types.core.IntracellularResponsesTable">IntracellularResponsesTable</a>'' because it is read-only.')
end
end
function val = validate_response(obj, val)
Expand Down
2 changes: 1 addition & 1 deletion +types/+core/IntracellularStimuliTable.m
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
if isequal(val, 'Table for storing intracellular stimulus related metadata.')
val = 'Table for storing intracellular stimulus related metadata.';
else
error('Unable to set the ''description'' property of class ''<a href="matlab:doc types.core.IntracellularStimuliTable">IntracellularStimuliTable</a>'' because it is read-only.')
error('NWB:Type:ReadOnlyProperty', 'Unable to set the ''description'' property of class ''<a href="matlab:doc types.core.IntracellularStimuliTable">IntracellularStimuliTable</a>'' because it is read-only.')
end
end
function val = validate_stimulus(obj, val)
Expand Down
2 changes: 1 addition & 1 deletion +types/+core/OptogeneticSeries.m
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
if isequal(val, 'watts')
val = 'watts';
else
error('Unable to set the ''data_unit'' property of class ''<a href="matlab:doc types.core.OptogeneticSeries">OptogeneticSeries</a>'' because it is read-only.')
error('NWB:Type:ReadOnlyProperty', 'Unable to set the ''data_unit'' property of class ''<a href="matlab:doc types.core.OptogeneticSeries">OptogeneticSeries</a>'' because it is read-only.')
end
end
function val = validate_site(obj, val)
Expand Down
6 changes: 3 additions & 3 deletions +types/+core/SpikeEventSeries.m
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
if isequal(val, 'volts')
val = 'volts';
else
error('Unable to set the ''data_unit'' property of class ''<a href="matlab:doc types.core.SpikeEventSeries">SpikeEventSeries</a>'' because it is read-only.')
error('NWB:Type:ReadOnlyProperty', 'Unable to set the ''data_unit'' property of class ''<a href="matlab:doc types.core.SpikeEventSeries">SpikeEventSeries</a>'' because it is read-only.')
end
end
function val = validate_timestamps(obj, val)
Expand All @@ -81,14 +81,14 @@
if isequal(val, 1)
val = 1;
else
error('Unable to set the ''timestamps_interval'' property of class ''<a href="matlab:doc types.core.SpikeEventSeries">SpikeEventSeries</a>'' because it is read-only.')
error('NWB:Type:ReadOnlyProperty', 'Unable to set the ''timestamps_interval'' property of class ''<a href="matlab:doc types.core.SpikeEventSeries">SpikeEventSeries</a>'' because it is read-only.')
end
end
function val = validate_timestamps_unit(obj, val)
if isequal(val, 'seconds')
val = 'seconds';
else
error('Unable to set the ''timestamps_unit'' property of class ''<a href="matlab:doc types.core.SpikeEventSeries">SpikeEventSeries</a>'' because it is read-only.')
error('NWB:Type:ReadOnlyProperty', 'Unable to set the ''timestamps_unit'' property of class ''<a href="matlab:doc types.core.SpikeEventSeries">SpikeEventSeries</a>'' because it is read-only.')
end
end
%% EXPORT
Expand Down
2 changes: 1 addition & 1 deletion +types/+core/TimeSeriesReferenceVectorData.m
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
return;
end
if ~istable(val) && ~isstruct(val) && ~isa(val, 'containers.Map')
error('Property `data` must be a table,struct, or containers.Map.');
error('NWB:Type:InvalidPropertyType', 'Property `data` must be a table, struct, or containers.Map.');
end
vprops = struct();
vprops.idx_start = 'int32';
Expand Down
2 changes: 1 addition & 1 deletion +types/+core/VoltageClampSeries.m
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@
if isequal(val, 'amperes')
val = 'amperes';
else
error('Unable to set the ''data_unit'' property of class ''<a href="matlab:doc types.core.VoltageClampSeries">VoltageClampSeries</a>'' because it is read-only.')
error('NWB:Type:ReadOnlyProperty', 'Unable to set the ''data_unit'' property of class ''<a href="matlab:doc types.core.VoltageClampSeries">VoltageClampSeries</a>'' because it is read-only.')
end
end
function val = validate_resistance_comp_bandwidth(obj, val)
Expand Down
2 changes: 1 addition & 1 deletion +types/+core/VoltageClampStimulusSeries.m
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
if isequal(val, 'volts')
val = 'volts';
else
error('Unable to set the ''data_unit'' property of class ''<a href="matlab:doc types.core.VoltageClampStimulusSeries">VoltageClampStimulusSeries</a>'' because it is read-only.')
error('NWB:Type:ReadOnlyProperty', 'Unable to set the ''data_unit'' property of class ''<a href="matlab:doc types.core.VoltageClampStimulusSeries">VoltageClampStimulusSeries</a>'' because it is read-only.')
end
end
%% EXPORT
Expand Down

0 comments on commit b02f126

Please sign in to comment.