Skip to content

Fix error handling in API #1141

Closed
Closed
@LaszloLango

Description

@LaszloLango

Details: #1138 (comment)

I think the general direction is very good. However, I feel people will not understand how the exception handling works in Jerry. Namely a value has an exception bit, and a value with an exception bit set cannot be passed to any function as input argument.

I am open to other ideas, but I see two directions at this moment:

  • all functions should return with a bool (exception or not), and a value as an output argument. The output contains the exception value in case of exception, but the exception bit is cleared, so they can pass it to other functions.
  • all functions return with a jerry value, where the exception bit can be set. There is an API function to check exceptions. For all input arguments the exception bit is cleared manually (so people cannot accidentally pass exception objects as values when setting a field of an object).

Metadata

Metadata

Assignees

No one assigned

    Labels

    apiRelated to the public API

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions