Clean up HTTP 500 errors in stderr
This commit is contained in:
parent
ac7935e24d
commit
785813f495
1 changed files with 7 additions and 1 deletions
|
@ -11,7 +11,7 @@ import { Configs } from "./data/Configs";
|
||||||
// Always use UTC internally
|
// Always use UTC internally
|
||||||
// This is also enforced for the database in data/db.ts
|
// This is also enforced for the database in data/db.ts
|
||||||
import moment from "moment-timezone";
|
import moment from "moment-timezone";
|
||||||
import { Client, TextChannel } from "eris";
|
import { Client, DiscordHTTPError, TextChannel } from "eris";
|
||||||
import { connect } from "./data/db";
|
import { connect } from "./data/db";
|
||||||
import { baseGuildPlugins, globalPlugins, guildPlugins } from "./plugins/availablePlugins";
|
import { baseGuildPlugins, globalPlugins, guildPlugins } from "./plugins/availablePlugins";
|
||||||
import { errorMessage, isDiscordHTTPError, isDiscordRESTError, MINUTES, successMessage } from "./utils";
|
import { errorMessage, isDiscordHTTPError, isDiscordRESTError, MINUTES, successMessage } from "./utils";
|
||||||
|
@ -77,6 +77,12 @@ if (process.env.NODE_ENV === "production") {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (err instanceof DiscordHTTPError && err.code === 500) {
|
||||||
|
// Don't need stack traces on HTTP 500 errors
|
||||||
|
console.error(err.message);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// tslint:disable:no-console
|
// tslint:disable:no-console
|
||||||
console.error(err);
|
console.error(err);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue