Skip to content

Commit e247be0

Browse files
committed
Consolidate error handling by introducing a new AuthResult class and updating display logic in several screens. Also removes passkey prompt in SiwG flow.
1 parent c8c2890 commit e247be0

14 files changed

+612
-462
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*
2+
* Copyright 2024 The Android Open Source Project
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package com.authentication.shrine.model
17+
18+
sealed class AuthResult<out T> {
19+
data class Success<out T>(val data: T) : AuthResult<T>()
20+
data class Failure(val error: AuthError) : AuthResult<Nothing>()
21+
}
22+
23+
sealed class AuthError {
24+
object NetworkError : AuthError()
25+
object UserAlreadyExists : AuthError()
26+
object InvalidCredentials : AuthError()
27+
data class ServerError(val message: String?) : AuthError()
28+
data class Unknown(val message: String?) : AuthError()
29+
}

0 commit comments

Comments
 (0)