Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

js catch rejected promise

//makeRequest returns promise using resolve(sucess)/reject(failure)
//use .then() the first function passed in will run on sucess, 
//the second function passed in will run on failure
makeRequest('GET',"https://mywebsite.com").then(
	function(r){
		console.log("success");
	},
	function(r){
		console.log("failure");
	}
);
Comment

PREVIOUS NEXT
Code Example
Javascript :: react native password meter 
Javascript :: password meter 
Javascript :: discord.js timeout 
Javascript :: remover ultimo character string javascript 
Javascript :: delete space from string javascript 
Javascript :: reflect javascript 
Javascript :: sequelize update sql 
Javascript :: ERROR in ./node_modules/react-icons/all.js 4:0-22 
Javascript :: react native navigation nested 
Javascript :: fs.readdir callback function 
Javascript :: javascript scroll tracker 
Javascript :: mongoose search in multiple fields 
Javascript :: this.handler.handle is not a function 
Javascript :: jshint 6 atom 
Javascript :: usecallback hook react 
Javascript :: react-native date time picker 
Javascript :: node-fetch 
Javascript :: for value in array javascript 
Javascript :: javascript remove multiple commas from string 
Javascript :: javascript check if array is subset of another 
Javascript :: window scroll top 
Javascript :: accept 2 values after decimal in angular forms 
Javascript :: react youtube npm 
Javascript :: jspdf create table 
Javascript :: mongoose show all indexes 
Javascript :: test if value is function 
Javascript :: get current date javascript yyyy-mm-dd 
Javascript :: check if the element exists in javascript 
Javascript :: js remove specific item from array 
Javascript :: js int to string base 
ADD CONTENT
Topic
Content
Source link
Name
3+5 =