oguzhanunlu opened a new pull request, #16507:
URL: https://github.com/apache/iceberg/pull/16507

   **Summary**
   Follow-up to #15746 / #16059 . Same unreliable triage pattern, at the OAuth2 
token endpoint instead of `/v1/config`.
   
   **Background**
   OAuth2 token endpoint failures (RFC 6749 §5.2) currently surface as generic 
`BadRequestException` /  `NotAuthorizedException`, with the error type 
stringified into the exception message. Consumers that triage on the error type 
must regex-parse the message to recover it.
   
   This PR introduces exceptions that carry the OAuth2 error type as a field 
accessible via a marker interface:
   
   ```
   OAuth2Error                  (marker, String errorType())
   OAuth2BadRequestException    extends BadRequestException implements 
OAuth2Error    (400)
   OAuth2NotAuthorizedException extends NotAuthorizedException implements 
OAuth2Error    (401)
   ```
   
   `OAuthErrorHandler.accept` now throws these for all six RFC 6749 §5.2 codes 
(invalid_request, invalid_client, invalid_grant, unauthorized_client, 
unsupported_grant_type, invalid_scope).
   
   **Design**
   Two classes (per HTTP status), not six (per error type). Different reasons 
within an HTTP status class are unified under one exception per status, 
consistent with how `BadRequestException` covers all 400s currently.
   
   Backward compatible: `getMessage()` output is byte-identical and existing 
catch blocks on `BadRequestException` / `NotAuthorizedException` continue to 
fire.
   
   Adds six unit tests that pin which exception is thrown for each OAuth2 error 
type.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to