Improve API of interface WellknownRetriever to be able to distinguish between 404 and other errors.
This commit is contained in:
parent
3f41108db6
commit
b45fb2128b
14 changed files with 196 additions and 96 deletions
|
|
@ -41,7 +41,7 @@ class DefaultAccountProviderAccessControl(
|
|||
// Ensure that Element Pro is not required for this account provider
|
||||
val wellKnown = wellknownRetriever.getElementWellKnown(
|
||||
baseUrl = accountProviderUrl.ensureProtocol(),
|
||||
)
|
||||
).dataOrNull()
|
||||
if (wellKnown?.enforceElementPro == true) {
|
||||
throw AccountProviderAccessException.NeedElementProException(
|
||||
unauthorisedAccountProviderTitle = title,
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ class HomeserverResolver(
|
|||
wellknownRetriever.getWellKnown(url)
|
||||
}
|
||||
}
|
||||
val isValid = wellKnown?.isValid().orFalse()
|
||||
val isValid = wellKnown?.dataOrNull()?.isValid().orFalse()
|
||||
if (isValid) {
|
||||
// Emit the list as soon as possible
|
||||
currentList.add(
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ class DefaultWebClientUrlForAuthenticationRetriever(
|
|||
Timber.w("Temporary account creation flow is only supported on matrix.org")
|
||||
throw AccountCreationNotSupported()
|
||||
}
|
||||
val wellknown = wellknownRetriever.getElementWellKnown(homeServerUrl)
|
||||
val wellknown = wellknownRetriever.getElementWellKnown(homeServerUrl).dataOrNull()
|
||||
?: throw AccountCreationNotSupported()
|
||||
val registrationHelperUrl = wellknown.registrationHelperUrl
|
||||
return if (registrationHelperUrl != null) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue