diff options
| author | winter | 2025-01-14 18:19:00 +0000 |
|---|---|---|
| committer | winter | 2025-01-14 18:19:00 +0000 |
| commit | eda5788d76ecb802fb174968a9ec1fb382670885 (patch) | |
| tree | 792812c9e64dbfe83ec106bf5e191308fb16a684 | |
| parent | 25b748f04911262826d0a0bc9609e03ee47c3232 (diff) | |
throw AuthException when push fails with 40x
| -rw-r--r-- | Digitigrade/Model/Instance.php | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/Digitigrade/Model/Instance.php b/Digitigrade/Model/Instance.php index c689657..6662d7e 100644 --- a/Digitigrade/Model/Instance.php +++ b/Digitigrade/Model/Instance.php @@ -205,6 +205,11 @@ class Instance extends FetchableModel { 'content' => json_encode($obj) ]]); file_get_contents($this->endpoints->push, context: $context); - return str_contains($http_response_header[0], '200'); + if (str_contains($http_response_header[0], '200')) { + return true; + } elseif (str_contains($http_response_header[0], '401') || str_contains($http_response_header[0], '403')) { + throw new AuthException($this); + } + return false; } }
\ No newline at end of file |
