question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

calling willMatchWith on a future() has uncaught error of missing 'listen' of undefined

See original GitHub issue

Hi there,

https://codesandbox.io/s/21o6kqn4zr

I made a simple sandbox here to show the problem, please look at the console, it’s the normale console in your browser.

In a nutshell, if we did

import { task } from "folktale/concurrency/task";

const delay = ms =>
  task(res => {
    setTimeout(() => res.resolve(ms), ms);
  });

const taskA = delay(1000);

console.log('taskA')
taskA.run().future().willMatchWith({
  Resolved: console.log,
  Rejected: console.log,
  Canceled: console.log
})

will throw

Uncaught TypeError: Cannot read property 'listen' of undefined
    at Object.onResolved (VM3955 dll.js:19248)
    at Object.Resolved (VM3955 dll.js:10379)
    at InternalConstructor.matchWith (VM3955 dll.js:419)
    at _loop (VM3955 dll.js:10376)
    at moveToState (VM3955 dll.js:10392)
    at Object.onResolved (VM3955 dll.js:10531)
    at Object.Resolved (VM3955 dll.js:10379)
    at InternalConstructor.matchWith (VM3955 dll.js:419)
    at _loop (VM3955 dll.js:10376)
    at moveToState (VM3955 dll.js:10392)
    at Deferred.resolve (VM3955 dll.js:10432)
    at Object.resolve (VM3955 dll.js:11016)
    at eval

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
niksosfcommented, Oct 11, 2017

Gotcha! Thanks again, really appreciate it!

0reactions
niksosfcommented, Oct 11, 2017

Hey @robotlolita , nice of the authors to put automated check on even the docs, it seems like. – Oh believe me, even the time I spent on researching this will be minor compared with the time I’ll save with the safer code I’ll write with it 😉

That makes a lot of sense, because the way listen is describe elsewhere on the same doc. The way I understand it is that listen is a straightforward unleashing the value to do some side-effect after a one off async action inside the task. Fair enough.

And willMatchWith will be used for continuing chaining/mapping, like you already said, transforming the data.

here’s that snippet on listen screen shot 2017-10-11 at 5 19 24 pm

Read more comments on GitHub >

github_iconTop Results From Across the Web

Futures and error handling - Dart programming language
In the example above, if myFunc() 's Future completes with a value, then() 's callback fires. If no new error is produced within...
Read more >
wait method - Future class - dart:async library
The cleanUp function is unused if there is no error. The call to cleanUp should not throw. If it does, the error will...
Read more >
Z-Push Zimbra Backend - Browse /Release70 at SourceForge ...
This project provides a zimbra backend for the z-push open source ActiveSync implementation (http://z-push.sourceforge.net). It supports push email,…
Read more >
Uncaught (in promise) Error: When called with an action of type
The request is okay and I can see the data when I console.log in the action creator but for some reason the reducer...
Read more >
2 Entities - Oracle Help Center
If unspecified, the Coherence cluster multicast listen port will be used. ... getErrorCode() ), indicate that a fatal error has occurred and the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found