Add exception reporting

This commit is contained in:
philipp lang 2022-02-19 15:33:49 +01:00
parent b8d2a04d43
commit 6c6212fa29
2 changed files with 17 additions and 0 deletions

View File

@ -3,6 +3,7 @@
namespace Zoomyboy\LaravelNami;
use Illuminate\Support\Str;
use Illuminate\Validation\ValidationException;
class LoginException extends \Exception {
@ -24,6 +25,11 @@ class LoginException extends \Exception {
$this->response = $response;
}
public function report(): void
{
throw ValidationException::withMessages(['nami' => 'NaMi Login fehlgeschlagen.']);
}
public function setReason($reason) {
$this->reason = $reason;
}

View File

@ -3,6 +3,7 @@
namespace Zoomyboy\LaravelNami;
use Illuminate\Support\Str;
use Illuminate\Validation\ValidationException;
class NamiException extends \Exception {
@ -29,4 +30,14 @@ class NamiException extends \Exception {
return $this;
}
public function report(): void
{
\Log::error($this->getMessage(), [
'request' => $this->request,
'response' => $this->response
]);
throw ValidationException::withMessages(['id' => 'Unbekannter Fehler']);
}
}