Add exception reporting
This commit is contained in:
parent
b8d2a04d43
commit
6c6212fa29
|
@ -3,6 +3,7 @@
|
||||||
namespace Zoomyboy\LaravelNami;
|
namespace Zoomyboy\LaravelNami;
|
||||||
|
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
|
use Illuminate\Validation\ValidationException;
|
||||||
|
|
||||||
class LoginException extends \Exception {
|
class LoginException extends \Exception {
|
||||||
|
|
||||||
|
@ -24,6 +25,11 @@ class LoginException extends \Exception {
|
||||||
$this->response = $response;
|
$this->response = $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function report(): void
|
||||||
|
{
|
||||||
|
throw ValidationException::withMessages(['nami' => 'NaMi Login fehlgeschlagen.']);
|
||||||
|
}
|
||||||
|
|
||||||
public function setReason($reason) {
|
public function setReason($reason) {
|
||||||
$this->reason = $reason;
|
$this->reason = $reason;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
namespace Zoomyboy\LaravelNami;
|
namespace Zoomyboy\LaravelNami;
|
||||||
|
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
|
use Illuminate\Validation\ValidationException;
|
||||||
|
|
||||||
class NamiException extends \Exception {
|
class NamiException extends \Exception {
|
||||||
|
|
||||||
|
@ -29,4 +30,14 @@ class NamiException extends \Exception {
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function report(): void
|
||||||
|
{
|
||||||
|
\Log::error($this->getMessage(), [
|
||||||
|
'request' => $this->request,
|
||||||
|
'response' => $this->response
|
||||||
|
]);
|
||||||
|
|
||||||
|
throw ValidationException::withMessages(['id' => 'Unbekannter Fehler']);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue