Uploaded image for project: 'Thrift'
  1. Thrift
  2. THRIFT-3916

Errors thrown from JavaScript client is strings and not errors

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • None
    • None
    • JavaScript - Compiler

    Description

      In JavaScript, you can throw any object, including strings, but to get stack traces one should throw Errors.

      The generated JS code throws the error string directly, instead of wrapping it in new Error.

      Node core only rejects with/throws Errors, never strings, and Thrift should follow the same standard.

      https://nodejs.org/api/errors.html#errors_class_error

      All errors generated by Node.js, including all System and JavaScript errors, will either be instances of, or inherit from, the Error class.

      PR for the change here.

      Attachments

        Activity

          People

            Unassigned Unassigned
            SimenB Simen Bekkhus
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated: