mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-15 19:13:31 +01:00
Removed redudant catch/throw operations as the error message is now actually useful
This commit is contained in:
@@ -309,10 +309,6 @@ export default class InternalClient {
|
|||||||
sendMessage(where, _content, options = {}) {
|
sendMessage(where, _content, options = {}) {
|
||||||
|
|
||||||
return this.resolver.resolveChannel(where)
|
return this.resolver.resolveChannel(where)
|
||||||
.catch(error => {
|
|
||||||
error.message = "Error resolving destination - " + error.toString();
|
|
||||||
throw error;
|
|
||||||
})
|
|
||||||
.then(destination => {
|
.then(destination => {
|
||||||
//var destination;
|
//var destination;
|
||||||
var content = this.resolver.resolveString(_content);
|
var content = this.resolver.resolveString(_content);
|
||||||
@@ -381,10 +377,6 @@ export default class InternalClient {
|
|||||||
// def sendFile
|
// def sendFile
|
||||||
sendFile(where, _file, name = "image.png") {
|
sendFile(where, _file, name = "image.png") {
|
||||||
return this.resolver.resolveChannel(where)
|
return this.resolver.resolveChannel(where)
|
||||||
.catch(error => {
|
|
||||||
error.message = "Couldn't resolve to channel - " + error.toString();
|
|
||||||
throw error;
|
|
||||||
})
|
|
||||||
.then(channel =>
|
.then(channel =>
|
||||||
request
|
request
|
||||||
.post(Endpoints.CHANNEL_MESSAGES(channel.id))
|
.post(Endpoints.CHANNEL_MESSAGES(channel.id))
|
||||||
@@ -398,10 +390,6 @@ export default class InternalClient {
|
|||||||
// def getChannelLogs
|
// def getChannelLogs
|
||||||
getChannelLogs(_channel, limit = 500, options = {}) {
|
getChannelLogs(_channel, limit = 500, options = {}) {
|
||||||
return this.resolver.resolveChannel(_channel)
|
return this.resolver.resolveChannel(_channel)
|
||||||
.catch(error => {
|
|
||||||
error.message = "Couldn't resolve to channel - " + error.toString();
|
|
||||||
throw error;
|
|
||||||
})
|
|
||||||
.then(channel => {
|
.then(channel => {
|
||||||
var qsObject = {limit};
|
var qsObject = {limit};
|
||||||
if (options.before) {
|
if (options.before) {
|
||||||
@@ -774,7 +762,8 @@ export default class InternalClient {
|
|||||||
|
|
||||||
//def startTyping
|
//def startTyping
|
||||||
startTyping(channel){
|
startTyping(channel){
|
||||||
return this.resolver.resolveChannel(channel).then(channel => {
|
return this.resolver.resolveChannel(channel)
|
||||||
|
.then(channel => {
|
||||||
|
|
||||||
if(this.typingIntervals[channel.id]){
|
if(this.typingIntervals[channel.id]){
|
||||||
// typing interval already exists, leave it alone
|
// typing interval already exists, leave it alone
|
||||||
@@ -782,7 +771,8 @@ export default class InternalClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.typingIntervals[channel.id] = setInterval(
|
this.typingIntervals[channel.id] = setInterval(
|
||||||
() => this.sendTyping(channel).catch(error => this.emit("error", error)),
|
() => this.sendTyping(channel)
|
||||||
|
.catch(error => this.emit("error", error)),
|
||||||
4000
|
4000
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user