Suspendable with Nullable

Viewed 47

I need to make the suspendable function Nullable. The expected behavior is, when I call the function, If it's an error body, It should simply return null rather than throwing HttpException.

@GET("product")
suspend fun getProduct(): Product?

Is it possible? If yes, how can I do that?

0 Answers
Related