errors: provide context
Sometimes our errors are not clear enough. To such a point that some people even think we have bugs. For instance:
In [2]: vcsn.Q.expression('a**').derived_term()
---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
<ipython-input-2-5535b777a125> in <module>()
----> 1 vcsn.Q.expression('a**').derived_term()
/Users/akim/src/lrde/2/python/vcsn/expression.py in derived_term(self, algo, lazy, deterministic, breaking)
99 if b:
100 algo += "," + tag
--> 101 return self._derived_term_orig(algo)
102
103
RuntimeError: q: star: invalid value: 1
Well, that's right, the expression is invalid. But the way we say it, some people don't see that the input is the problem.
We need to give more context to our errors.
Maybe Boost.Exception can help here. The idea would be to catch low-level errors at higher levels to enrich the exception and then to rethrow it.