Ability to listen to InvalidItemBehaviour
It would great to somehow hook into when InvalidItemBehaviours happen, especially the non throwing kinds, like .remove .value, and .custom when it doesn't throw.
That way a client app can log a warning or somehow be alerted to otherwise unnoticed events. (To for example alert the backend that certain elements are malformed)
Because there is no state that is passed through the decoding process, maybe just a static func on InvalidItemNotifier that would maintain a static array of listeners:
static func addListener(handler: (InvalidItemEvent) -> ()) -> InvalidItemNotifier.Listener
Thoughts?
This idea could also be useful for loggin purposes while debugging by hooking up to the listener.
I'm wondering if having a global listener is the right approach. My concerns are around memory management, will there be a need to remove this listener.
Potentially would we not want to log any kind of parsing error?
Food for thought.
Yeah, to be honest I'm not super satisfied with the approach taken in #19 , especially the static listeners. Because JSONUtilities doesn't use a decoder or mapper like some other libraries though, there doesn't seem a good place to store state. Another simpler approach is to just have a single closure that you can set on the notifier (still static), though this is less flexible. Do you have any suggestions?
The use case I wanted to originally solve was having a way of being notified of silent errors, so they don't go un-noticed