You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "James E. King, III (JIRA)" <ji...@apache.org> on 2016/10/18 12:57:58 UTC

[jira] [Commented] (THRIFT-3916) Errors thrown from JavaScript client is strings and not errors

    [ https://issues.apache.org/jira/browse/THRIFT-3916?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15585392#comment-15585392 ] 

James E. King, III commented on THRIFT-3916:
--------------------------------------------

Looks like a good idea to improve the compiler and runtime behavior.  My only question is will this cause a stack trace to be sent from the server to the client?  If so, that's a pretty big security issue and it would need to be conditional on whether it was a debug or release build.  In a release build, the server cannot send a stack trace to the client as that exposes too much about the internals of the server.

> Errors thrown from JavaScript client is strings and not errors
> --------------------------------------------------------------
>
>                 Key: THRIFT-3916
>                 URL: https://issues.apache.org/jira/browse/THRIFT-3916
>             Project: Thrift
>          Issue Type: Bug
>          Components: JavaScript - Compiler
>            Reporter: Simen Bekkhus
>            Priority: Minor
>              Labels: javascript
>
> 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
> {quote}
> All errors generated by Node.js, including all System and JavaScript errors, will either be instances of, or inherit from, the Error class.
> {quote}
> PR for the change [here|https://github.com/apache/thrift/pull/1075].



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)