The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

405599 (4) [Avatar] Offline
In listing 8.7 after line
representative.nickname = 'Tenno';

browser (Google Chrome and Firefox) print error
Uncaught TypeError: 'set' on proxy: trap returned falsish for property 'nickname'
On I found some explanation:
The set method should return a boolean value. Return true to indicate that assignment succeeded. If the set method returns false, and the assignment happened in strict-mode code, a TypeError will be thrown.

But why, then, there is no explanation in the book?
405599 (4) [Avatar] Offline
Can the authors answer my question please ?
Josip Maras (30) [Avatar] Offline
Hi Kostya,

I ran listing 8.7 in both Chrome 54.0.2840.98 and Firefox 50.0 and all seems to be good (both on Mac OS).

But, if you check out:
you can see that the method should return a boolean value to indicate whether the set has been successful or not.

So in this case, my suggestion is to modify the set handler in the following way:

set: (target, key, value) => {
  report("Writing " + key + " through a proxy");
  target[key] = value;
  return true; //Add this