Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 21, 2025

User configuration and environment errors were throwing InvalidOperationException, causing them to be sent to Sentry as application bugs. These should throw AppUserException instead to prevent false error reports.

Changes

WindowsMediaOcr.cs

  • Window size exceeding OcrEngine.MaxImageDimension

GoogleAI Plugin (3 locations)

  • Uninitialized Gemini client
  • Invalid API key (400 errors)
  • Replaced hardcoded error message with localized resource string

LLM Plugin (4 locations)

  • Uninitialized LLM client
  • Missing API key or model configuration

OneOCR Plugin (5 locations)

  • OCR initialization failures (init options, lazy load, pipeline creation, process options, max line count)

Example

// Before
if (newWidth > OcrEngine.MaxImageDimension)
{
    throw new InvalidOperationException($"ウィンドウサイズが大きすぎます...");
}

// After
if (newWidth > OcrEngine.MaxImageDimension)
{
    throw new AppUserException($"ウィンドウサイズが大きすぎます...");
}

All error messages use existing localized resource strings for consistency.

Original prompt

This section details on the original issue you should resolve

<issue_title>想定されている例外をAppUserExcptionに置き換える</issue_title>
<issue_description>例外の種類によって、挙動を分けている。
AppUserExcptionはユーザーの設定や環境起因の問題でアプリの不具合ではないので、Sentryに送信しないダイアログが表示される。
AppUserExcption以外は不明なエラーなので、Sentryに送信可能なダイアログが表示される。

現状、ユーザーの設定起因の例外もAppUserExcptionを使っていない箇所があるので、AppUserExcptionに置き換える。</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits December 21, 2025 10:40
Co-authored-by: Freeesia <9002657+Freeesia@users.noreply.github.com>
Co-authored-by: Freeesia <9002657+Freeesia@users.noreply.github.com>
Copilot AI changed the title [WIP] Replace exceptions with AppUserException for user settings issues Replace user-caused exceptions with AppUserException Dec 21, 2025
Copilot AI requested a review from Freeesia December 21, 2025 10:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

想定されている例外をAppUserExcptionに置き換える

2 participants