Initial import from Alltube app
Removed dependency on Config and LocaleManager classes Avoid using generic exceptions
This commit is contained in:
commit
98b74fd6f2
16 changed files with 3935 additions and 0 deletions
13
classes/exceptions/AlltubeLibraryException.php
Normal file
13
classes/exceptions/AlltubeLibraryException.php
Normal file
|
@ -0,0 +1,13 @@
|
|||
<?php
|
||||
|
||||
namespace Alltube\Library\Exception;
|
||||
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* Base class for Alltube exceptions.
|
||||
*/
|
||||
abstract class AlltubeLibraryException extends Exception
|
||||
{
|
||||
|
||||
}
|
20
classes/exceptions/AvconvException.php
Normal file
20
classes/exceptions/AvconvException.php
Normal file
|
@ -0,0 +1,20 @@
|
|||
<?php
|
||||
|
||||
namespace Alltube\Library\Exception;
|
||||
|
||||
use Throwable;
|
||||
|
||||
/**
|
||||
* Can't find avconv or ffmpeg.
|
||||
*/
|
||||
class AvconvException extends AlltubeLibraryException
|
||||
{
|
||||
/**
|
||||
* AvconvException constructor.
|
||||
* @param string $path Path to avconv or ffmpeg.
|
||||
*/
|
||||
public function __construct($path)
|
||||
{
|
||||
parent::__construct("Can't find avconv or ffmpeg at " . $path . '.');
|
||||
}
|
||||
}
|
18
classes/exceptions/EmptyUrlException.php
Normal file
18
classes/exceptions/EmptyUrlException.php
Normal file
|
@ -0,0 +1,18 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* EmptyUrlException class.
|
||||
*/
|
||||
|
||||
namespace Alltube\Library\Exception;
|
||||
|
||||
/**
|
||||
* Exception thrown when youtube-dl returns an empty URL.
|
||||
*/
|
||||
class EmptyUrlException extends AlltubeLibraryException
|
||||
{
|
||||
/**
|
||||
* @var string Error message
|
||||
*/
|
||||
protected $message = 'youtube-dl returned an empty URL.';
|
||||
}
|
18
classes/exceptions/InvalidProtocolConversionException.php
Normal file
18
classes/exceptions/InvalidProtocolConversionException.php
Normal file
|
@ -0,0 +1,18 @@
|
|||
<?php
|
||||
|
||||
namespace Alltube\Library\Exception;
|
||||
|
||||
/**
|
||||
* Invalid conversion.
|
||||
*/
|
||||
class InvalidProtocolConversionException extends AlltubeLibraryException
|
||||
{
|
||||
/**
|
||||
* InvalidProtocolConversionException constructor.
|
||||
* @param string $protocol Protocol
|
||||
*/
|
||||
public function __construct($protocol)
|
||||
{
|
||||
parent::__construct($protocol . ' protocol is not supported in conversions.');
|
||||
}
|
||||
}
|
19
classes/exceptions/InvalidTimeException.php
Normal file
19
classes/exceptions/InvalidTimeException.php
Normal file
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
|
||||
namespace Alltube\Library\Exception;
|
||||
|
||||
/**
|
||||
* Invalid time.
|
||||
*/
|
||||
class InvalidTimeException extends AlltubeLibraryException
|
||||
{
|
||||
|
||||
/**
|
||||
* InvalidTimeException constructor.
|
||||
* @param string $time Invalid time
|
||||
*/
|
||||
public function __construct($time)
|
||||
{
|
||||
parent::__construct('Invalid time: ' . $time);
|
||||
}
|
||||
}
|
14
classes/exceptions/PasswordException.php
Normal file
14
classes/exceptions/PasswordException.php
Normal file
|
@ -0,0 +1,14 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* PasswordException class.
|
||||
*/
|
||||
|
||||
namespace Alltube\Library\Exception;
|
||||
|
||||
/**
|
||||
* Exception thrown when a video requires a password.
|
||||
*/
|
||||
class PasswordException extends AlltubeLibraryException
|
||||
{
|
||||
}
|
14
classes/exceptions/PlaylistConversionException.php
Normal file
14
classes/exceptions/PlaylistConversionException.php
Normal file
|
@ -0,0 +1,14 @@
|
|||
<?php
|
||||
|
||||
namespace Alltube\Library\Exception;
|
||||
|
||||
/**
|
||||
* Conversion of playlists is not supported.
|
||||
*/
|
||||
class PlaylistConversionException extends AlltubeLibraryException
|
||||
{
|
||||
/**
|
||||
* @var string Error message
|
||||
*/
|
||||
protected $message = 'Conversion of playlists is not supported.';
|
||||
}
|
14
classes/exceptions/PopenStreamException.php
Normal file
14
classes/exceptions/PopenStreamException.php
Normal file
|
@ -0,0 +1,14 @@
|
|||
<?php
|
||||
|
||||
namespace Alltube\Library\Exception;
|
||||
|
||||
/**
|
||||
* Could not open popen stream.
|
||||
*/
|
||||
class PopenStreamException extends AlltubeLibraryException
|
||||
{
|
||||
/**
|
||||
* @var string Error message
|
||||
*/
|
||||
protected $message = 'Could not open popen stream.';
|
||||
}
|
10
classes/exceptions/RemuxException.php
Normal file
10
classes/exceptions/RemuxException.php
Normal file
|
@ -0,0 +1,10 @@
|
|||
<?php
|
||||
|
||||
namespace Alltube\Library\Exception;
|
||||
|
||||
/**
|
||||
* Generic remux exception.
|
||||
*/
|
||||
class RemuxException extends AlltubeLibraryException
|
||||
{
|
||||
}
|
14
classes/exceptions/WrongPasswordException.php
Normal file
14
classes/exceptions/WrongPasswordException.php
Normal file
|
@ -0,0 +1,14 @@
|
|||
<?php
|
||||
|
||||
namespace Alltube\Library\Exception;
|
||||
|
||||
/**
|
||||
* Wrong password.
|
||||
*/
|
||||
class WrongPasswordException extends AlltubeLibraryException
|
||||
{
|
||||
/**
|
||||
* @var string Error message.
|
||||
*/
|
||||
protected $message = 'Wrong password.';
|
||||
}
|
10
classes/exceptions/YoutubedlException.php
Normal file
10
classes/exceptions/YoutubedlException.php
Normal file
|
@ -0,0 +1,10 @@
|
|||
<?php
|
||||
|
||||
namespace Alltube\Library\Exception;
|
||||
|
||||
/**
|
||||
* Generic youtube-dl error.
|
||||
*/
|
||||
class YoutubedlException extends AlltubeLibraryException
|
||||
{
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue