Skip to content

Add error notification system with alert dialogs and stack trace logging#183

Draft
Copilot wants to merge 5 commits intomainfrom
copilot/add-error-notification-system
Draft

Add error notification system with alert dialogs and stack trace logging#183
Copilot wants to merge 5 commits intomainfrom
copilot/add-error-notification-system

Conversation

Copy link
Contributor

Copilot AI commented Jan 2, 2026

Implements centralized error handling: all system errors now display via alert() with full stack traces logged to console. Only runScenario() catches errors; all other handlers throw exceptions for proper propagation.

Changes

Logger enhancement (src/utils/logger.ts)

  • Added logError() function capturing stack traces via stacktrace-js
  • Null-safe stack frame property access with fallback logging

Error handling unification (src/core/index.js)

  • runScenario(): wrapped in try-catch, logs errors and shows alert dialog
  • Resource handlers (getImageObject, getSoundObject, executeCode, loadHandler): removed silent error handling, now throw exceptions
  • Removed duplicate checkResourceExists() method

Error flow:

// Handler throws exception
async getImageObject(line) {
  if (!(await this.checkResourceExists(line.src))) {
    throw new Error(`Image file not found: ${line.src}`)
  }
  // ...
}

// runScenario catches, logs, and alerts
async runScenario() {
  try {
    await boundFunction(scenarioObject)
  } catch (error) {
    await logError(error, 'Error in runScenario')  // Console: full stack trace
    alert(`システムエラーが発生しました:\n${error.message}`)  // User: clear message
  }
}

Console output example:

ERROR:
Context: Error in runScenario
Message: Image file not found: /src/resource/image.png
Stack trace:
    at getImageObject (index.js:481:7)
    at showHandler (index.js:384:26)
    at runScenario (index.js:229:13)

Test coverage: 6 unit tests for logger functionality in tests/logger.test.ts

Original prompt

This section details on the original issue you should resolve

<issue_title>エラー表示の追加</issue_title>
<issue_description>システムエラーを、Alertで通知し、エラーログにスタックトレースを保存する

runScenario以外は、例外をスローする。


Trelloから移行 (todo): https://trello.com/c/CYhKe2cZ</issue_description>

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


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI self-assigned this Jan 2, 2026
Copilot AI and others added 4 commits January 2, 2026 15:50
Co-authored-by: EndoHizumi <5486808+EndoHizumi@users.noreply.github.com>
Co-authored-by: EndoHizumi <5486808+EndoHizumi@users.noreply.github.com>
Co-authored-by: EndoHizumi <5486808+EndoHizumi@users.noreply.github.com>
…ror message

Co-authored-by: EndoHizumi <5486808+EndoHizumi@users.noreply.github.com>
Copilot AI changed the title [WIP] Add error notification and logging system Add error notification system with alert dialogs and stack trace logging Jan 2, 2026
Copilot AI requested a review from EndoHizumi January 2, 2026 16:00
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.

エラー表示の追加

2 participants