Added can't stream error before adding to queue
This commit is contained in:
@@ -1,3 +1,16 @@
|
||||
const { TrackFormats } = require('deezer-js')
|
||||
|
||||
const bitrateLabels = {
|
||||
[TrackFormats.MP4_RA3]: '360 HQ',
|
||||
[TrackFormats.MP4_RA2]: '360 MQ',
|
||||
[TrackFormats.MP4_RA1]: '360 LQ',
|
||||
[TrackFormats.FLAC]: 'FLAC',
|
||||
[TrackFormats.MP3_320]: '320kbps',
|
||||
[TrackFormats.MP3_128]: '128kbps',
|
||||
[TrackFormats.DEFAULT]: '128kbps',
|
||||
[TrackFormats.LOCAL]: 'MP3'
|
||||
}
|
||||
|
||||
export class BadRequestError extends Error {
|
||||
constructor() {
|
||||
super()
|
||||
@@ -31,3 +44,12 @@ export class NotLoggedIn extends QueueError {
|
||||
this.name = 'NotLoggedIn'
|
||||
}
|
||||
}
|
||||
|
||||
export class CantStream extends QueueError {
|
||||
bitrate: number
|
||||
constructor(bitrate: number) {
|
||||
super(`Your account can't stream at ${bitrateLabels[bitrate]}.`)
|
||||
this.name = 'CantStream'
|
||||
this.bitrate = bitrate
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user