-
Notifications
You must be signed in to change notification settings - Fork 215
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ファイル存在チェックの強化 #1727
ファイル存在チェックの強化 #1727
Conversation
lib/review/pdfmaker.rb
Outdated
@@ -471,6 +479,8 @@ def latex_config | |||
result << "%% END: config-local.tex.erb\n" | |||
end | |||
result | |||
rescue StandardError => e |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rescue StandardError => e | |
rescue ApplicationError => e |
ReVIEW::ConfigError
等を拾うのであれば ApplicationError
でできます(何でもStandardErrorで握りつぶしてしまうのは良くなさそうなので)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ERBのbindでエラーが出たときにSyntaxError, ZeroDivisionErrorなど予想がつかない生の例外がきてしまうんですよね。ApplicationErrorで拾えなくて困っています。
StandardErrorにしていた理由としては、
ApplicationErrorのみの捕捉だと
と生の例外がきてバックトレースが出てしまいます。バックトレースを出さずに妥当なエラーメッセージだけを表示したいとなると全捕捉するしかなさそうで困っているのでした。 例は極端ですが、String期待のつもりがnilでエラーを起こすみたいなパターンはそれなりにありそうです。 |
うーん、テンプレートまで手を入れている場合、むしろバックトレース等含めてエラー出してくれた方がテンプレート編集のデバッグがやりやすくないですか…?(どこまで手を入れるかにもよりますが)
|
上記のトレースだと7より上のものが無意味なのが気にいらないんですよねぇ…。まぁlayouts.tex.erbやconfig-local.erbを持ってる時点で覚悟せよとすべきか。ただconfig.erbレベルでももしかしたらconfig.ymlによってはERBエラー起こせるかも。 |
そうですね、 |
|
今のTemplateからだとApplicationErrorをスローするものがないのでrescue ApplicationErrorはだめそうでした。
これだといかがでしょう。 |
なるほどです、このあたりが落とし所でしょうか。 |
Co-authored-by: Masayoshi Takahashi <takahashim@users.noreply.github.com>
Add test against `template_content`
#1726 のEPUB coverimage対応と、PDFMakerの外部ファイル取り込み部のチェック強化です。
pdfmaker.rb#make_custom_page
内)。実ファイルが絡むのでテストを作りづらい…。