Koans online task #32 returns Internal Server Error


#1

Was trying Koans online task #32 - Properties, when pressing “check” the results never returned, “error : Internal Server Error” is shown


#2

Do you mean this task? https://try.kotlinlang.org/#/Kotlin%20Koans/Properties/Properties/Task.kt

I’ve tried to reproduce it and got another problem (pressing “Check” button doesn’t show the result of test the first time), but nothing close to Internal Server Error.

Does it still happen?


#3

Yes, still happens, please check out the screenshot


#4

Your code is invalid. It will cause a stack overflow (the setter recursively calls itself). You should use the field identifier to access the property’s storage.

var propertyWithCounter: Int? = null
    set(value:Int?) {
        counter++
        field = value
    }

Given this, the error message is not helpful. Something that provides better diagnostics would be very helpful.


#5

It works now, thanks for helping