### Reporting errors is a must-have feature of a good software

by Forrest Sheng Bao http://fsbao.net

I happen to use two MATLAB toolboxes in one project now. Of course, you can make mistakes when using any software, e.g., giving the improper parameters.

The very annoying thing happens on one of the toolboxes (let me call it "the unprofessional one"), which does not tell me the possible error i make. It's very like the blue screen of Windows - "all we can tell you is to restart your Windows box." Hold on, what is the problem? What can I do to avoid this?

To solve the problem, I have to debug on my own, which is very time-consuming. Simply telling people the existence of error is not error reporting.

So what is a good one? Let's take a look at the error reporting example below.

>> save_nii_series('dspm8_SUGER-HEALTH01_NBH-EPI_20100917_02',1000,4189)

* - SPM8: rest_spm_vol  --------------------------------------------

Unable to find file:
..R-HEALTH01_NBH-EPI_20100917_02_1000.nii

-----------------------------------------  20:48:19 - 12/12/2010

??? Error using ==> rest_ReadNiftiImage at 104
Meet error while reading data. Please restart MATLAB, this problem may be
solved.

Error in ==> save_nii_series at 18
data = rest_ReadNiftiImage(nii_name);

The last four lines of error are produced by the unprofessional one, which only tells me there is an error but not what kind of error. It also gives me an incorrect instruction, restarting MATLAB. Not to mention that it has English grammar errors in the error reporting.

In contrast, the first a couple of lines of error are produced by SPM, a famous neuroimaging toolbox for MATLAB. It tells me the exact error, file path incorrectness.