jeffmur / fhel

Fully Homomorphic Encryption Library

Home Page:https://pub.dev/packages/fhel

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error Handling

jeffmur opened this issue Β· comments

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