Skip to content

Commit

Permalink
ENH - add ft_error to the private directory of modules
Browse files Browse the repository at this point in the history
  • Loading branch information
robertoostenveld committed Feb 9, 2024
1 parent 9df5ec5 commit 1e7fa24
Show file tree
Hide file tree
Showing 8 changed files with 296 additions and 2 deletions.
18 changes: 16 additions & 2 deletions bin/synchronize-private.sh
Expand Up @@ -833,6 +833,20 @@ ARRAY+=(forward/ft_estimate_units.m)
ARRAY+=(plotting/private/ft_estimate_units.m)
sync ${ARRAY[*]}

################################################################################
# ft_error.m, should be consistent with ft_notification and ft_warning

ARRAY=()
ARRAY+=(connectivity/private/ft_error.m)
ARRAY+=(fileio/private/ft_error.m)
ARRAY+=(forward/private/ft_error.m)
ARRAY+=(inverse/private/ft_error.m)
ARRAY+=(plotting/private/ft_error.m)
ARRAY+=(preproc/private/ft_error.m)
ARRAY+=(specest/private/ft_error.m)
ARRAY+=(utilities/ft_error.m)
sync ${ARRAY[*]}

################################################################################
# ft_fetch_data.m

Expand Down Expand Up @@ -1026,7 +1040,7 @@ ARRAY+=(inverse/private/ft_inv.m)
sync ${ARRAY[*]}

################################################################################
# ft_notification.m, should be consistent with ft_warning
# ft_notification.m, should be consistent with ft_warning and ft_error

ARRAY=()
ARRAY+=(connectivity/private/ft_notification.m)
Expand Down Expand Up @@ -1121,7 +1135,7 @@ ARRAY+=(utilities/ft_setopt.m)
sync ${ARRAY[*]}

################################################################################
# ft_warning.m, should be consistent with ft_notification.m
# ft_warning.m, should be consistent with ft_notification and ft_error

ARRAY=()
ARRAY+=(connectivity/private/ft_warning.m)
Expand Down
40 changes: 40 additions & 0 deletions connectivity/private/ft_error.m
@@ -0,0 +1,40 @@
function varargout = ft_error(varargin)

% FT_ERROR prints an error message on screen, just like the standard ERROR function.
%
% Use as
% ft_error(...)
% with arguments similar to fprintf, or
% ft_error(msgId, ...)
% with arguments similar to error.
%
% See also FT_ERROR, FT_WARNING, FT_NOTICE, FT_INFO, FT_DEBUG, ERROR, WARNING

% Copyright (C) 2017, Robert Oostenveld
%
% This file is part of FieldTrip, see http://www.fieldtriptoolbox.org
% for the documentation and details.
%
% FieldTrip is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% FieldTrip is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with FieldTrip. If not, see <http://www.gnu.org/licenses/>.
%
% $Id$

if nargout
[varargout{1:nargout}] = ft_notification(varargin{:});
elseif isequal(varargin, {'last'})
% return an answer anyway
varargout{1} = ft_notification(varargin{:});
else
ft_notification(varargin{:});
end
40 changes: 40 additions & 0 deletions fileio/private/ft_error.m
@@ -0,0 +1,40 @@
function varargout = ft_error(varargin)

% FT_ERROR prints an error message on screen, just like the standard ERROR function.
%
% Use as
% ft_error(...)
% with arguments similar to fprintf, or
% ft_error(msgId, ...)
% with arguments similar to error.
%
% See also FT_ERROR, FT_WARNING, FT_NOTICE, FT_INFO, FT_DEBUG, ERROR, WARNING

% Copyright (C) 2017, Robert Oostenveld
%
% This file is part of FieldTrip, see http://www.fieldtriptoolbox.org
% for the documentation and details.
%
% FieldTrip is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% FieldTrip is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with FieldTrip. If not, see <http://www.gnu.org/licenses/>.
%
% $Id$

if nargout
[varargout{1:nargout}] = ft_notification(varargin{:});
elseif isequal(varargin, {'last'})
% return an answer anyway
varargout{1} = ft_notification(varargin{:});
else
ft_notification(varargin{:});
end
40 changes: 40 additions & 0 deletions forward/private/ft_error.m
@@ -0,0 +1,40 @@
function varargout = ft_error(varargin)

% FT_ERROR prints an error message on screen, just like the standard ERROR function.
%
% Use as
% ft_error(...)
% with arguments similar to fprintf, or
% ft_error(msgId, ...)
% with arguments similar to error.
%
% See also FT_ERROR, FT_WARNING, FT_NOTICE, FT_INFO, FT_DEBUG, ERROR, WARNING

% Copyright (C) 2017, Robert Oostenveld
%
% This file is part of FieldTrip, see http://www.fieldtriptoolbox.org
% for the documentation and details.
%
% FieldTrip is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% FieldTrip is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with FieldTrip. If not, see <http://www.gnu.org/licenses/>.
%
% $Id$

if nargout
[varargout{1:nargout}] = ft_notification(varargin{:});
elseif isequal(varargin, {'last'})
% return an answer anyway
varargout{1} = ft_notification(varargin{:});
else
ft_notification(varargin{:});
end
40 changes: 40 additions & 0 deletions inverse/private/ft_error.m
@@ -0,0 +1,40 @@
function varargout = ft_error(varargin)

% FT_ERROR prints an error message on screen, just like the standard ERROR function.
%
% Use as
% ft_error(...)
% with arguments similar to fprintf, or
% ft_error(msgId, ...)
% with arguments similar to error.
%
% See also FT_ERROR, FT_WARNING, FT_NOTICE, FT_INFO, FT_DEBUG, ERROR, WARNING

% Copyright (C) 2017, Robert Oostenveld
%
% This file is part of FieldTrip, see http://www.fieldtriptoolbox.org
% for the documentation and details.
%
% FieldTrip is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% FieldTrip is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with FieldTrip. If not, see <http://www.gnu.org/licenses/>.
%
% $Id$

if nargout
[varargout{1:nargout}] = ft_notification(varargin{:});
elseif isequal(varargin, {'last'})
% return an answer anyway
varargout{1} = ft_notification(varargin{:});
else
ft_notification(varargin{:});
end
40 changes: 40 additions & 0 deletions plotting/private/ft_error.m
@@ -0,0 +1,40 @@
function varargout = ft_error(varargin)

% FT_ERROR prints an error message on screen, just like the standard ERROR function.
%
% Use as
% ft_error(...)
% with arguments similar to fprintf, or
% ft_error(msgId, ...)
% with arguments similar to error.
%
% See also FT_ERROR, FT_WARNING, FT_NOTICE, FT_INFO, FT_DEBUG, ERROR, WARNING

% Copyright (C) 2017, Robert Oostenveld
%
% This file is part of FieldTrip, see http://www.fieldtriptoolbox.org
% for the documentation and details.
%
% FieldTrip is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% FieldTrip is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with FieldTrip. If not, see <http://www.gnu.org/licenses/>.
%
% $Id$

if nargout
[varargout{1:nargout}] = ft_notification(varargin{:});
elseif isequal(varargin, {'last'})
% return an answer anyway
varargout{1} = ft_notification(varargin{:});
else
ft_notification(varargin{:});
end
40 changes: 40 additions & 0 deletions preproc/private/ft_error.m
@@ -0,0 +1,40 @@
function varargout = ft_error(varargin)

% FT_ERROR prints an error message on screen, just like the standard ERROR function.
%
% Use as
% ft_error(...)
% with arguments similar to fprintf, or
% ft_error(msgId, ...)
% with arguments similar to error.
%
% See also FT_ERROR, FT_WARNING, FT_NOTICE, FT_INFO, FT_DEBUG, ERROR, WARNING

% Copyright (C) 2017, Robert Oostenveld
%
% This file is part of FieldTrip, see http://www.fieldtriptoolbox.org
% for the documentation and details.
%
% FieldTrip is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% FieldTrip is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with FieldTrip. If not, see <http://www.gnu.org/licenses/>.
%
% $Id$

if nargout
[varargout{1:nargout}] = ft_notification(varargin{:});
elseif isequal(varargin, {'last'})
% return an answer anyway
varargout{1} = ft_notification(varargin{:});
else
ft_notification(varargin{:});
end
40 changes: 40 additions & 0 deletions specest/private/ft_error.m
@@ -0,0 +1,40 @@
function varargout = ft_error(varargin)

% FT_ERROR prints an error message on screen, just like the standard ERROR function.
%
% Use as
% ft_error(...)
% with arguments similar to fprintf, or
% ft_error(msgId, ...)
% with arguments similar to error.
%
% See also FT_ERROR, FT_WARNING, FT_NOTICE, FT_INFO, FT_DEBUG, ERROR, WARNING

% Copyright (C) 2017, Robert Oostenveld
%
% This file is part of FieldTrip, see http://www.fieldtriptoolbox.org
% for the documentation and details.
%
% FieldTrip is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% FieldTrip is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with FieldTrip. If not, see <http://www.gnu.org/licenses/>.
%
% $Id$

if nargout
[varargout{1:nargout}] = ft_notification(varargin{:});
elseif isequal(varargin, {'last'})
% return an answer anyway
varargout{1} = ft_notification(varargin{:});
else
ft_notification(varargin{:});
end

0 comments on commit 1e7fa24

Please sign in to comment.