https://kotlinlang.org logo
#coroutines
Title
# coroutines
r

raulraja

01/24/2019, 2:53 PM
The
@RestrictSuspension
annotations does a great job and has proven very useful for controlling side effects in Arrow. Kudos to everyone involved with the suspend system! The only problem I'm having is that the compiler error messages for restricted contexts are not very useful. They just state the arbitrary suspended function can't run there. I would like to customize such error messages a la carte to provide reasons why functions are restricted in a suspended receiver. For example:
Copy code
save() can't be invoked in this [UI] scope because is scoped to [DB]
Is there a way to customize such error messages? If not is this something that would change in the compiler or std lib?
e

elizarov

01/25/2019, 7:15 AM
Not at the moment, but you are welcome to submit an issue to http://kotl.in/issue with your use-case and a suggestion for a better error message. However, making them customizable is a whole another topic — you can also suggest it, but don’t mix those two together into the same issue, please.
👍 1
3 Views