mirror of
				https://github.com/BookStackApp/BookStack.git
				synced 2025-10-31 03:50:27 +03:00 
			
		
		
		
	Remove unnecessary UnauthorizedException and make ApiAuthException compatible with HttpExceptionInterface. Move the creation of a rsponse for the exception from ApiAuthenticate middleware into the application exception handler.
		
			
				
	
	
		
			27 lines
		
	
	
		
			545 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			27 lines
		
	
	
		
			545 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
| <?php
 | |
| 
 | |
| namespace BookStack\Exceptions;
 | |
| 
 | |
| use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface;
 | |
| 
 | |
| class ApiAuthException extends \Exception implements HttpExceptionInterface
 | |
| {
 | |
|     protected int $status;
 | |
| 
 | |
|     public function __construct(string $message, int $statusCode = 401)
 | |
|     {
 | |
|         $this->status = $statusCode;
 | |
|         parent::__construct($message, $statusCode);
 | |
|     }
 | |
| 
 | |
|     public function getStatusCode(): int
 | |
|     {
 | |
|         return $this->status;
 | |
|     }
 | |
| 
 | |
|     public function getHeaders(): array
 | |
|     {
 | |
|         return [];
 | |
|     }
 | |
| }
 |