Skip to content

Crash on Classroom api error #26518

Open
Open
@cvetelinandreev

Description

@cvetelinandreev

Whenever the API call failes I get the whole app crashed.

v1-rev20250303-2.0.0

What could be the issue?

20:04:57.248  E  FATAL EXCEPTION: DefaultDispatcher-worker-1
                 Process: ..., PID: 20922
                 com.google.api.client.googleapis.json.GoogleJsonResponseException: 500 Internal Server Error
                 GET https://classroom.googleapis.com/v1/courses
                 {
                   "code": 500,
                   "errors": [
                     {
                       "domain": "global",
                       "message": "Internal error encountered.",
                       "reason": "backendError"
                     }
                   ],
                   "message": "Internal error encountered.",
                   "status": "INTERNAL"
                 }
                 	at com.google.api.client.googleapis.services.json.AbstractGoogleJsonClientRequest.newExceptionOnError(AbstractGoogleJsonClientRequest.java:118)
                 	at com.google.api.client.googleapis.services.json.AbstractGoogleJsonClientRequest.newExceptionOnError(AbstractGoogleJsonClientRequest.java:37)
                 	at com.google.api.client.googleapis.services.AbstractGoogleClientRequest$3.interceptResponse(AbstractGoogleClientRequest.java:479)
                 	at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:1111)
                 	at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:565)
                 	at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:506)
                 	at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(AbstractGoogleClientRequest.java:616)
                 	at com.learntogether.umo.screens.topbar.SyncViewModel$onSync$1.invokeSuspend(SyncViewModel.kt:57)
                 	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
                 	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108)
                 	at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:584)
                 	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:793)
                 	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:697)
                 	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:684)
                 	Suppressed: kotlinx.coroutines.internal.DiagnosticCoroutineContextException: [StandaloneCoroutine{Cancelling}@5a649f5, Dispatchers.Default]
20:04:57.265  I  Sending signal. PID: 20922 SIG: 9

This is line 57 from SyncViewModel

 try {
            GlobalScope.launch {
                val service = Classroom.Builder(GoogleNetHttpTransport.newTrustedTransport(), GsonFactory.getDefaultInstance(), credential)
                    .setApplicationName("Umo")
                    .build()

                if (isConnected.value) {
57:                    val response = service.Courses().list().execute()

        } catch (e: Exception) {
            taskCompletionSource.setException(e)
        }

I'm able to reproduce the issue when I'm offline and I execute the code quoted above.

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority: p3Desirable enhancement or fix. May not be included in next release.type: questionRequest for information or clarification. Not an issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions