Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error Handling #39

Closed
jeffmur opened this issue Feb 17, 2024 · 0 comments 路 Fixed by #40
Closed

Error Handling #39

jeffmur opened this issue Feb 17, 2024 · 0 comments 路 Fixed by #40

Comments

@jeffmur
Copy link
Owner

jeffmur commented Feb 17, 2024

Dart cannot natively handle errors, rather 'fails unexpectedly' when C throws any error.

Importance: Flutter must capture errors to alert the user to make changes, so C errors must be converted into Dart

Approach 1: ErrorTranslator 馃弳
C++ object that is always passed by reference for every function.
It should capture + handle various (if not all) error types.
From Dart, we would try to access data stored in C Memory to retrieve the current "status" of our function call / stack.

Pros:

  • Follows same pattern as Afhe, passed by reference with attributes

Cons:

  • Modifies every existing function

Approach 2: Specialized return types
For objects, create sub-routine .status() returns error message if any
For int or string return types, use -1

Cons:

  • Non-objects are ambiguous, less control for error messages
  • Prone to issues, hard coded values
@jeffmur jeffmur mentioned this issue Feb 18, 2024
jeffmur added a commit that referenced this issue Feb 18, 2024
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 a pull request may close this issue.

1 participant