Fixing Promise 'TypeError: myfunc(...).then(...).reject is not a function'

When encountering this error message in Javascript related to Promises:

TypeError: myfunc(...).then(...).reject is not a function

The solution is quite simple: When you want to catch the error from the promise, you need to use catch instead of reject like this:

myfunc(...).then(...).catch(...)