Skip to content

fix exception handling in hostFileNative#399

Merged
andiwand merged 1 commit into
mainfrom
fix-exception-handling-hostFileNative
Jul 8, 2025
Merged

fix exception handling in hostFileNative#399
andiwand merged 1 commit into
mainfrom
fix-exception-handling-hostFileNative

Conversation

@andiwand
Copy link
Copy Markdown
Member

@andiwand andiwand commented Jul 8, 2025

No description provided.

@andiwand andiwand requested review from TomTasche and Copilot July 8, 2025 06:48
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR enhances exception handling in hostFileNative, adding nested try-catch blocks to map specific C++ exceptions to distinct JNI error codes and reformats the native method signature.

  • Wraps file hosting logic in an outer and inner try-catch to handle UnknownFileType, UnsupportedFileType, generic std::exception, and all other exceptions with different error codes.
  • Updates engine_priority initialization formatting and adjusts logging calls.
  • Reformats method signatures for hostFileNative and listenServerNative.
Comments suppressed due to low confidence (2)

app/src/main/cpp/CoreWrapper.cpp:427

  • [nitpick] The new error code -5 for UnknownFileType should be documented—add a comment or update JNI-side docs to explain this mapping.
        } catch (const odr::UnknownFileType &e) {

app/src/main/cpp/CoreWrapper.cpp:427

  • [nitpick] New exception branches (UnknownFileType, UnsupportedFileType, etc.) lack unit or integration tests—add tests to verify each error code path.
        } catch (const odr::UnknownFileType &e) {

Comment thread app/src/main/cpp/CoreWrapper.cpp
Comment thread app/src/main/cpp/CoreWrapper.cpp
Comment thread app/src/main/cpp/CoreWrapper.cpp
@andiwand andiwand changed the title fix exception handling in hostFileNative fix exception handling in hostFileNative Jul 8, 2025
Copy link
Copy Markdown
Member

@TomTasche TomTasche left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@andiwand andiwand merged commit 16cf8ac into main Jul 8, 2025
4 checks passed
@andiwand andiwand deleted the fix-exception-handling-hostFileNative branch July 8, 2025 18:02
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.

3 participants