Open kawacchu opened 4 years ago
イシュー立てありがとうございます。
やるとしたら、assert_or_raise_parser_error
みたいな関数を作ってassertと差し替えることになるんでしょうが、、
該当箇所が多いですし、ぱっと見では見分けが簡単につかないところもありますね。
実績的にassertがfailしてないならそこまで優先順位は高くないのかな。 ただし、ユーザーに見えちゃった部分、見えそうな部分(不安定なコンテスト)があれば教えてください。
SampleParseErrorはoj
の能力の限界であることが明示されるのに対し、assert落ちはユーザーには何が起きたかわからないため、表に出ちゃうとよくないと思います。
手元で比較してみましたが、raise SampleParseError
を発生させるほうが処理の全体を見通しやすいです。log.errorと併用して、更に賢いエラー報告も期待できます。
online-judge-tools/oj#637
基本的に私は賛成ですが、 refactoring の複雑さと実用性の向上で天秤にかけているところです。