core-java
core-java copied to clipboard
Errors in code of receptors must be visible in console
I was working on a test fixture CountingContext
using Kotlin DSL and couldn't get results I expected from the very simple logic.
It turned out that I used DSL in a wrong way. It caused UnsupportedOperationException
on a map object delegate deep inside Protobuf. It wasn't visible at all because we catch
exceptions, create errors, and associate them with the dispatched signal. But nothing happens in the console about it. It just goes silently and smoothly, but in a wrong way.
We need to shout about such errors. Otherwise, it takes much time to catch it, and the silence is a disservice.
We have discussed similar cases in real projects. Let's gather on Monday and discuss this one as well.
A comment from a user (copied from Google Chat):
Столкнулся со следующей проблемой во время тестирования Backlog: BBC тесты дают false-positive результаты, если state объекта после обработки цепочки событий нечаянно совпадает с тем, что мы ожидаем в тест кейса. Такое совпадение возможно, если во время обработки сигнала было брошено исключение, например, в @Apply методе.
Пример из Backlog. Цепочка событий IssueCreated -> IssueLabeled -> IssueUnlabeled должна привести к тому, что у issue поле label пустое. Если убрать событие IssueLabeled из цепочки, поле label всё еще пустое и тест проходит, однако DiagnosticsLogger на самом деле логгирует, что мы не смогли обработать IssueUnlabeled событие.
Предложение: давайте во время тестов пробрасывать исключения из обработчиков событий наверх.