Repository navigation
Commit 6f5b5ad
THRIFT-6418: Give the browser TApplicationException the symbol-keyed read and write methods
Client: js
Generated JavaScript code reads and writes structs through the keys
Symbol.for("read") and Symbol.for("write"). Since 5fc920d (0.21.0) the
generated client also reads an EXCEPTION reply that way, calling
x[Symbol.for("read")](input) on a new Thrift.TApplicationException.
lib/nodejs gives its TApplicationException both keys, but lib/js did not,
so a browser client threw "TypeError: x[Symbol.for(...)] is not a
function" instead of the TApplicationException the server sent. The two
keys now point at the existing read() and write(), as in lib/nodejs.
The ant JSLint check in lib/js/test/build.xml reads thrift.js as ES3,
where "for" cannot be a property name, so it now runs with the es5
option.
The test that should have caught this could not. test_handler.js took
TException from the top level of the Node.js library, where it is
undefined, so testException("TException") failed inside the test server
with HTTP 500, and the TException test in test.js had been changed to
accept any error. The handler now uses Thrift.TException, and the test
expects the TApplicationException that the server sends for an
undeclared exception. A second test decodes an EXCEPTION reply through
the generated client without a server.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>1 parent 5cba029 commit 6f5b5ad
4 files changed
Lines changed: 36 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
263 | 263 | | |
264 | 264 | | |
265 | 265 | | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
266 | 272 | | |
267 | 273 | | |
268 | 274 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
182 | 182 | | |
183 | 183 | | |
184 | 184 | | |
185 | | - | |
| 185 | + | |
| 186 | + | |
186 | 187 | | |
187 | 188 | | |
188 | 189 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
315 | 315 | | |
316 | 316 | | |
317 | 317 | | |
318 | | - | |
319 | | - | |
320 | | - | |
| 318 | + | |
| 319 | + | |
321 | 320 | | |
322 | | - | |
323 | | - | |
324 | | - | |
325 | | - | |
326 | | - | |
327 | | - | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
328 | 346 | | |
329 | 347 | | |
330 | 348 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
| 26 | + | |
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| |||
0 commit comments