diff --git a/firebase-functions/src/androidTest/java/com/google/firebase/functions/StreamTests.kt b/firebase-functions/src/androidTest/java/com/google/firebase/functions/StreamTests.kt index 3548c56f05f..c66e15a7d4e 100644 --- a/firebase-functions/src/androidTest/java/com/google/firebase/functions/StreamTests.kt +++ b/firebase-functions/src/androidTest/java/com/google/firebase/functions/StreamTests.kt @@ -34,16 +34,16 @@ class StreamTests { functions = FirebaseFunctions.getInstance() listener = object : SSETaskListener { - override fun onNext(event: Any) { - onNext.add(event) + override fun onNext(message: Any) { + onNext.add(message) } - override fun onError(event: Any) { - onError = event + override fun onError(exception: FirebaseFunctionsException) { + onError = exception } - override fun onComplete(event: Any) { - onComplete = event + override fun onComplete(result: Any) { + onComplete = result } } } diff --git a/firebase-functions/src/main/java/com/google/firebase/functions/FirebaseFunctions.kt b/firebase-functions/src/main/java/com/google/firebase/functions/FirebaseFunctions.kt index 2858c009ce5..a1e244eaf8d 100644 --- a/firebase-functions/src/main/java/com/google/firebase/functions/FirebaseFunctions.kt +++ b/firebase-functions/src/main/java/com/google/firebase/functions/FirebaseFunctions.kt @@ -378,7 +378,7 @@ internal constructor( call.enqueue( object : Callback { override fun onFailure(ignored: Call, e: IOException) { - val exception: Exception = + val exception: FirebaseFunctionsException = if (e is InterruptedIOException) { FirebaseFunctionsException( FirebaseFunctionsException.Code.DEADLINE_EXCEEDED.name, @@ -406,18 +406,18 @@ internal constructor( if (bodyStream != null) { processSSEStream(bodyStream, serializer, listener, tcs) } else { - val error = + val exception = FirebaseFunctionsException( "Response body is null", FirebaseFunctionsException.Code.INTERNAL, null ) - listener.onError(error) - tcs.setException(error) + listener.onError(exception) + tcs.setException(exception) } - } catch (e: FirebaseFunctionsException) { - listener.onError(e) - tcs.setException(e) + } catch (exception: FirebaseFunctionsException) { + listener.onError(exception) + tcs.setException(exception) } } } diff --git a/firebase-functions/src/main/java/com/google/firebase/functions/SSETaskListener.kt b/firebase-functions/src/main/java/com/google/firebase/functions/SSETaskListener.kt index dffeddfeec2..85d21c7f1df 100644 --- a/firebase-functions/src/main/java/com/google/firebase/functions/SSETaskListener.kt +++ b/firebase-functions/src/main/java/com/google/firebase/functions/SSETaskListener.kt @@ -4,11 +4,11 @@ package com.google.firebase.functions public interface SSETaskListener { /** Called when a new event is received. */ - public fun onNext(event: Any) + public fun onNext(message: Any) /** Called when an error occurs. */ - public fun onError(event: Any) + public fun onError(exception: FirebaseFunctionsException) /** Called when the stream is closed. */ - public fun onComplete(event: Any) + public fun onComplete(result: Any) }