blob: 9217c5cad079933b7a059a31fa8ee29912938d97 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
<?php
namespace App\Exceptions;
use Exception;
class FileUploadException extends Exception
{
public static function fileTooLarge(int $maxSize)
{
return new self("File exceeds maximum size of {$maxSize}KB");
}
public static function invalidMimeType(string $mimeType)
{
return new self("File type '{$mimeType}' is not allowed");
}
public static function invalidExtension(string $extension)
{
return new self("File extension '.{$extension}' is not allowed");
}
public static function chunkMismatch(string $uploadId)
{
return new self("Chunk validation failed for upload {$uploadId}");
}
public static function chunksIncomplete(string $uploadId, int $expected, int $found)
{
return new self("Incomplete chunks for upload {$uploadId}: expected {$expected}, found {$found}");
}
public static function storageError(string $message)
{
return new self("Storage error: {$message}");
}
public static function tooManyFiles(int $max)
{
return new self("Maximum of {$max} files can be uploaded at once");
}
}
|