thrift-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Henrique Mendonca (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (THRIFT-1232) JavaScript TException should be a constructor function
Date Wed, 06 Jul 2011 16:03:17 GMT

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

Henrique Mendonca commented on THRIFT-1232:
-------------------------------------------

actually... following THRIFT-724 and https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Error
, I think it shouldn't inherit TException at all...

Perhaps extend it from Error like MDN suggests?

DerivedException = function(args) {
  this.prototype = Error.prototype;
  this.name = 'DerivedException';
...
}

then you could even get rid of Thrift.inherits() and Thrift.TException on Thrift.js all together.



> JavaScript TException should be a constructor function
> ------------------------------------------------------
>
>                 Key: THRIFT-1232
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1232
>             Project: Thrift
>          Issue Type: Bug
>          Components: JavaScript - Library
>            Reporter: Pascal Bach
>            Priority: Minor
>              Labels: exception-handling, js
>
> The JavaScript TException is declared as an object with a prototype property assigned
to it.
> It should be declared as a constructor function with a prototype. Otherwise exceptions
derived from TException using Thrift.inherits are not instances of TException.
> Example:
> function DerivedException() {};
> Thrift.inherits(DerivedException, Thrift.TException);
> var ex = new DerivedException();
> ex instanceof Thrift.TException // => Error as TException is not a function

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message