Mejoras en la api
This commit is contained in:
25
backend/app/Exceptions/GenericException.php
Normal file
25
backend/app/Exceptions/GenericException.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Exceptions;
|
||||
|
||||
use Exception;
|
||||
|
||||
class GenericException extends Exception {
|
||||
|
||||
protected $error;
|
||||
protected $message;
|
||||
protected $status;
|
||||
|
||||
public function __construct($error, $message, $status) {
|
||||
$this->error = $error;
|
||||
$this->message = $message;
|
||||
$this->status = $status;
|
||||
}
|
||||
|
||||
public function render($request) {
|
||||
return response()->json([
|
||||
'error' => $this->error
|
||||
'message' => $this->message
|
||||
], $status);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user