gochan-org / gochan

Error objects should be used as Promise rejection reasons JS-0114
Anti-pattern
Major
2 months ago2 years old
Expected the Promise rejection reason to be an Error
25
26	Notification.requestPermission().then(granted => {
27		if(granted !== "granted")
28			return Promise.reject("denied");29	}).catch(err => {
30		if(err !== "denied")
31			console.log(`Error starting notifications: ${err}`);
Expected the Promise rejection reason to be an Error
60		return Promise.reject("not in a board");
61	}
62	if(threadInfo.id < 1) {
63		return Promise.reject("not in a thread");64	}
65
66	const data = await $.ajax({
Expected the Promise rejection reason to be an Error
57		threadInfo.id = thread;
58
59	if(threadInfo.board === "") {
60		return Promise.reject("not in a board");61	}
62	if(threadInfo.id < 1) {
63		return Promise.reject("not in a thread");