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

support native C++ language specific exception message

VotersStop watchingWatchersLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 0.2
    • Fix Version/s: 0.9.3
    • Component/s: C++ - Compiler
    • Labels:
      None
    • Environment:

      all

      Description

      The current exception implement requires the error message to be declared and referenced explicitly, especially when it's sent from server to the client. On client side, this error message cannot be accessed via a native API like exception::what() in C++.

      Example,

      exception MyException {
        1: i32   code;
        2: string message;
      }
      

      On client side, it can only be accessed like this,

      try {
        server->someMethod();
      } catch (MyException &e) {
        cout << "MyException: " << e.message << endl;     // this will print the exception message
        cout << "MyException: " << e.what() << endl;      // this will print TException::Default
      }
      

      At the same time, if TException::message_ is initialized, exception::what() does work when the exception is caught locally.

      It's a little confusing when to use the native method, and when to use Thrift exception message data member.

      It'll be really nice if all exception messages can be accessed the same way thru the navtive language on client side.

        Attachments

        Issue Links

          Activity

            People

            • Assignee:
              AnnaDymek Anna Dymek
              Reporter:
              pingli Ping Li

              Dates

              • Created:
                Updated:
                Resolved:

                Issue deployment