Skip to content

Handling exception on intercept method #87

@Hitmasu

Description

@Hitmasu

#85 (comment)

When Jitex intercepts a method, we don't add any exception handling. Therefore, if the method throws an exception, the Interceptor will be interrupted without a return or calling ReleaseTask.

Eg.:

public int IsEven(int number) {
  //Jitex interceptor implementation...
  if (context.ProceedCall) {
    if (number == 0)
      throw new InvalidOperationException();

    result = number % 0 == 1;
  }
  callManager.ReleaseTask();
}

Should be:

public int IsEven(int number) {
  //Jitex interceptor implementation...
  if (context.ProceedCall) {
    try {
      if (number == 0)
        throw new InvalidOperationException();

      result = number % 0 == 1;
    } catch (Exception ex) {
      context.SetException(ex);
    }
  }

  if (context.Exception != null)
    throw context.Exception;

  callManager.ReleaseTask();
}

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions