feat: classify authorization-required errors (#1056)
This commit is contained in:
parent
3240b6e782
commit
65f05e9924
1 changed files with 142 additions and 0 deletions
|
|
@ -111,6 +111,17 @@ impl ClientInitializeError {
|
|||
}
|
||||
None
|
||||
}
|
||||
|
||||
/// Returns whether client initialization failed because authorization is required.
|
||||
///
|
||||
/// This covers both missing or expired local OAuth authorization and an HTTP
|
||||
/// authorization challenge from the MCP server.
|
||||
pub fn is_authorization_required(&self) -> bool {
|
||||
matches!(
|
||||
self,
|
||||
Self::TransportError { error, .. } if error.is_authorization_required()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
/// Helper function to get the next message from the stream
|
||||
|
|
|
|||
Loading…
Reference in a new issue