PixelPiggy/CS_float
0
1class Error {2 constructor(message, internalCode, statusCode) {3 this.message = message;4 this.code = internalCode;5 this.statusCode = statusCode; // HTTP Status Code6 }7 8 getJSON() {9 return {error: this.message, code: this.code, status: this.statusCode};10 }11 12 respond(res) {13 res.status(this.statusCode).json(this.getJSON());14 }15 16 toString() {17 return `[Code ${this.code}] - ${this.message}`;18 }19}20 21module.exports = {22 Error: Error,23 BadParams: new Error('Improper Parameter Structure', 1, 400),24 InvalidInspect: new Error('Invalid Inspect Link Structure', 2, 400),25 MaxRequests: new Error('You have too many pending requests', 3, 400),26 TTLExceeded: new Error('Valve\'s servers didn\'t reply in time', 4, 500),27 SteamOffline: new Error('Valve\'s servers appear to be offline, please try again later', 5, 503),28 GenericBad: new Error('Something went wrong on our end, please try again', 6, 500),29 BadBody: new Error('Improper body format', 7, 400),30 BadSecret: new Error('Bad Secret', 8, 400),31 NoBotsAvailable: new Error('No bots available to fulfill this request', 9, 500),32 RateLimit: new Error('Rate limit exceeded, too many requests', 10, 429),33 MaxQueueSize: new Error('Queue size is full, please try again later', 11, 500),34};35 36 37 