Open vinx13 opened 5 years ago
I would really like to take this up since i am very intrested in the usability project.Is there any other informacion or specific steps?
the only additional information regarding this that since this issue was created those macros has been changed to function calls; see for example REQUIRE
is require
. for more details about this changes check the SGIO.h
other than that as it is described the problem is that we are using one specific exception type to throw mark errors, and these should be actually distinguished a bit better by introducing different exception types. Before really jumping into coding it would be good to come up at least with 2-3 exception types - by looking at the places where we actually call error/require, and see if we should have a common type for certain type of errors.
for example there are times we when we a model's train_machine method is being called and we check that the passed feature class is from a certain type of feature. if that's not the case we should have something similar to an std::invalid_argument exception... but maybe more specific, like InvalidFeatureTypeException.
note before you really jump into coding, provide here the above mentioned 2-3 use-cases and then we can take it from there.
Currently, we use three macros in
ASSERT
,REQUIRE
andSG_ERROR
.ASSERT
andREQUIRE
are assertions.SG_ERROR
is used to throw an exception with some message. All of them throwShogunException
.Throwing custom exceptions instead of
ShogunException
can provide more information. We can get the information not only from the error message but also from the exception type. The macrosREQUIRE_E
orSG_THROW
added last year allows us to throw exceptions with custom types. We should replaceASSERT
,SG_ERROR
,REQUIRE
withREQUIRE_E
orSG_THROW
to throw custom exceptions. SeePipeline
for example usage of these macros.This is related to GSoC usability project.