Promise Error
See original GitHub issueGreat Library 😃
Though am running into an error when trying to send a simple sms. Seems to be something when returning a promise.
Here is the error
.then(function(s) {
^
TypeError: Cannot read property 'then' of undefined
Code:
var AfricasTalking = require('africastalking')(options);
var sms = AfricasTalking.SMS;
var opts = {
to: 0704654445,
message: 'Server is Running'
};
console.log(opts);
sms.send(opts)
.then(function(s) {
console.log(s);
})
.catch(function(error) {
console.log(error);
});
Issue Analytics
- State:
- Created 7 years ago
- Comments:7 (7 by maintainers)
Top Results From Across the Web
Error handling with promises - The Modern JavaScript Tutorial
Promise chains are great at error handling. When a promise rejects, the control jumps to the closest rejection handler.
Read more >Promise.prototype.catch() - JavaScript - MDN Web Docs
The catch method is used for error handling in promise composition. Since it returns a Promise , it can be chained in the...
Read more >Promise Error Handling - JavaScript Tutorial
In this tutorial, you will learn about promise error handling that shows you how to handle error in promises.
Read more >Promises - Error Handling - Beginner JavaScript - Wes Bos
The way you catch an error in a promise is you chain a .catch() to it. Catch will pass you the error as...
Read more >How do I handle errors with promises? - Stack Overflow
myFn(param).then(function(calcN){ // here, you throw to raise an error and return to resolve // new Promise should be used only when ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The issue is that your number is not a string and in the format
+2547xxxxxxx
@aksalj or @ianjuma 😃 need to fix the error message for when you have an invalid number format
@aksalj i updated the library to version
0.0.2
. Works fine Now. 😃