Skip to content
This repository was archived by the owner on Mar 17, 2025. It is now read-only.

[FirebaseObject] Error message is never reset #390

Closed
kptdobe opened this issue Nov 20, 2018 · 1 comment
Closed

[FirebaseObject] Error message is never reset #390

kptdobe opened this issue Nov 20, 2018 · 1 comment

Comments

@kptdobe
Copy link
Contributor

kptdobe commented Nov 20, 2018

While exploring the "patch" requests (see #321), I realised you cannot test if some properties are present in the FirebaseObject / event. Consider this code:

FirebaseObject event = Firebase.readEvent();

String v = event.getString('nonexistingproperty'); // v = ""
println(event.error()); // prints "failed to convert to string"

v = event.getString('existingproperty'); // v = "value of existingproperty"
println(event.error()); // still prints "failed to convert to string"

The main issue here is that you can only test once if a property exists or not using FirebaseObject#failed() or FirebaseObject#success(): once the error message is set in the FirebaseObject, it is never reset.

@samtstern
Copy link
Contributor

Fixed in #391

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants