Skip to content

Commit 2b474a9

Browse files
committed
feat: code refactored
Signed-off-by: Gaurav Goel <[email protected]>
1 parent 695a354 commit 2b474a9

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

core/src/main/java/com/web3auth/core/Web3Auth.kt

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ class Web3Auth(web3AuthOptions: Web3AuthOptions, context: Context) {
170170
if (error == null) {
171171
web3AuthResponse = resp
172172
} else {
173-
print(error)
173+
initializeCf.completeExceptionally(error)
174174
}
175175
initializeCf.complete(null)
176176
}
@@ -333,7 +333,15 @@ class Web3Auth(web3AuthOptions: Web3AuthOptions, context: Context) {
333333
val sessionResponse: CompletableFuture<String> =
334334
sessionManager.authorizeSession(origin, context)
335335
sessionResponse.whenComplete { response, error ->
336-
if (error == null) {
336+
if (response.contains("Error")) {
337+
sessionCompletableFuture.completeExceptionally(
338+
Exception(
339+
Web3AuthError.getError(
340+
ErrorCode.NOUSERFOUND
341+
)
342+
)
343+
)
344+
} else if (error == null) {
337345
val tempJson = JSONObject(response)
338346
web3AuthResponse = gson.fromJson(tempJson.toString(), Web3AuthResponse::class.java)
339347
if (web3AuthResponse?.error?.isNotBlank() == true) {

0 commit comments

Comments
 (0)