Opened 14 years ago

Closed 13 years ago

#189 closed enhancement (fixed)

There are output to cerr in some library classes. Should these throw exceptions?

Reported by: Jari Häkkinen Owned by: Jari Häkkinen
Priority: minor Milestone: yat 0.5
Component: regression Version: trunk
Keywords: Cc:

Description

If an exception is to be thrown, which exception should that be?

An example on cerr producing code:

source:trunk/yat/regression/Local.cc at approximately line 53:

if (step_size==0 || nof_points<3){
	std::cerr << "yat::regression::Local "
		  << "Parameters invalid. Fitting ignored." << std::endl;
	return;
}

Change History (6)

comment:1 Changed 14 years ago by Peter

Milestone: later

In the example above I think it looks like a clear case for Mr Exception.

However, I took a glance in source:trunk/yat/regression/SVM.cc and there are in several cases similar code, and I am not very convinced it is obvious to throw exception all those cases. I presume there are cerr usage in other classes as well...

comment:2 Changed 14 years ago by Jari Häkkinen

If we are to throw exceptions we may need to create another exception. As it is now, we only have GSL_error and IO_error.

comment:3 Changed 13 years ago by Peter

(in [1049]) replaced some cerr outputs with exception throws - refs #189

comment:4 Changed 13 years ago by Peter

Milestone: yat 0.x+yat 0.5
Owner: changed from Peter to Jari Häkkinen

I cannot find any cerr. Does it mean we can close this ticket?

comment:5 Changed 13 years ago by Jari Häkkinen

There are cerrs in WilcoxonFoldChange?.cc:

signori:yat> find . -name '*.cc' -exec grep cerr {} \; -print
    std::cerr << " WilcoxonFoldChange::score  not implemented" << std::endl;
    std::cerr << " WilcoxonFoldChange::score  not implemented" << std::endl;
./yat/statistics/WilcoxonFoldChange.cc

other matches are omitted. Should we remove the above?

comment:6 Changed 13 years ago by Peter

Resolution: fixed
Status: newclosed

I'll remove the warnings when implementing the function. I have moved that ticket (#20) to milestone 0.5.

Note: See TracTickets for help on using tickets.