Files
webtorrent-desktop/src/renderer/lib/errors.js
Diego Rodríguez Baquero 7e8078ed92 esm
2021-10-11 18:27:41 -05:00

44 lines
1.1 KiB
JavaScript

import ExtendableError from 'es6-error'
/* Generic errors */
class CastingError extends ExtendableError {
}
class PlaybackError extends ExtendableError {
}
class SoundError extends ExtendableError {
}
class TorrentError extends ExtendableError {
}
/* Playback */
class UnplayableTorrentError extends PlaybackError {
constructor () { super('Can\'t play any files in torrent') }
}
class UnplayableFileError extends PlaybackError {
constructor () { super('Can\'t play that file') }
}
/* Sound */
class InvalidSoundNameError extends SoundError {
constructor (name) { super(`Invalid sound name: ${name}`) }
}
/* Torrent */
class TorrentKeyNotFoundError extends TorrentError {
constructor (torrentKey) { super(`Can't resolve torrent key ${torrentKey}`) }
}
export { CastingError }
export { PlaybackError }
export { SoundError }
export { TorrentError }
export { UnplayableTorrentError }
export { UnplayableFileError }
export { InvalidSoundNameError }
export { TorrentKeyNotFoundError }
export default {
CastingError,
PlaybackError,
SoundError,
TorrentError,
UnplayableTorrentError,
UnplayableFileError,
InvalidSoundNameError,
TorrentKeyNotFoundError
}