Skip to content

Enable rethrowing of errors and passing in strings to errors #446

Closed

Description

@hokiegeek2

There are sections of code within Arkouda that throw new Errors in error catch blocks such as this:

image

It could help in debugging if we enable rethrowing errors by passing the root error in to the init method of the Error being rethrown. It should be pretty straightforward, basically need to add an init method that accepts an Error parameter:

image

Also, would recommend adding init methods that accept strings which should also help in debugging.

Activity

  1. changed the title [-]Enable rethrowing of root errors[/-] [+]Enable rethrowing of errors and passing in strings to errors[/+] on Jul 23, 2020
  2. hokiegeek2 commented on Oct 6, 2020

    @hokiegeek2
    ContributorAuthor

    Leveraged the getLineNumber(), getRoutineName(), and getModuleName() functions @mhmerrill mentioned, which works well:

    image

    image

    Probably a good idea to implement a factory to generate the derived classes of ErrorWithContext.

  3. hokiegeek2 commented on Oct 15, 2020

    @hokiegeek2
    ContributorAuthor

    @mhmerrill @reuster986 I updated the error message generation logic to deliver the following:

    1. Two types of messages: one that includes the entire context, which is accessible via ErrorWithContext.message(), which is inherited from the core Chapel Error class, and a second that only contains the string that should be sent back to the calling object and Python client, which is accessible via the ErrorWithContext.publish() method. An example is shown below:

    image

    This enables easier integration into try...catch blocks by replacing custom error message generation with invocations of the ErrorWithContext.message() and ErrorWithContext.publish() functions:

    image

    1. Capture of Error class name and inclusion within ErrorWithContext.message() output

    2. Extension of the Errors.getErrorWithContext factory function to enable integration of standard Chapel Errors into the ErrorsWithContext message generation paradigm, which ensures Arkouda can generate consistent error messages with the same contextual information. The message is generated in the following helper function:

    image

    An example of core Chapel Error message integration is shown below for FileNotFoundError:

    image

  4. hokiegeek2 commented on Oct 15, 2020

    @hokiegeek2
    ContributorAuthor

    A few more examples (the top one shows an error handling bug that should be addressed):

    image

    image

  5. hokiegeek2 commented on Oct 18, 2020

    @hokiegeek2
    ContributorAuthor

    @mhmerrill @reuster986 Shall I roll this out across the rest of Arkouda?

  6. hokiegeek2 commented on Oct 20, 2020

    @hokiegeek2
    ContributorAuthor

    Some more examples of revised error handling. In the first, a sort is attempted on a bool array:

    image

    Attempted concatenation of float and bool pdarray:

    image

  7. hokiegeek2 commented on Oct 20, 2020

    @hokiegeek2
    ContributorAuthor

    Attempted insertion of pdarray of unsupportted datatype in SymTable:

    image

    Attempted is_sorted invocation on bool array:

    image

  8. hokiegeek2 commented on Oct 20, 2020

    @hokiegeek2
    ContributorAuthor

    NotImplementedError thrown in UniqueMsg:

    image

    image

    NotImplementedError thrown in eFuncMsg

    image

  9. hokiegeek2 commented on Oct 20, 2020

    @hokiegeek2
    ContributorAuthor

    Error in adding unsupported dtype to MultiTypeSymbolTable:

    image

  10. hokiegeek2 commented on Oct 20, 2020

    @hokiegeek2
    ContributorAuthor

    ak.histogram on bool array:

    image

  11. hokiegeek2 commented on Oct 20, 2020

    @hokiegeek2
    ContributorAuthor

    Attempted sort on boolean array:

    image

  12. hokiegeek2 commented on Oct 22, 2020

    @hokiegeek2
    ContributorAuthor

    Development and testing complete, PR merged, issue resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions