more error standardisation on android

This commit is contained in:
Salakar 2017-03-09 15:29:08 +00:00
parent e48e5c290e
commit b02bcbd9cf
1 changed files with 9 additions and 13 deletions

View File

@ -147,8 +147,8 @@ public class RNFirebaseDatabase extends ReactContextBaseJavaModule {
public void onComplete(DatabaseError error, DatabaseReference ref) { public void onComplete(DatabaseError error, DatabaseReference ref) {
if (error != null) { if (error != null) {
WritableMap err = Arguments.createMap(); WritableMap err = Arguments.createMap();
err.putInt("errorCode", error.getCode()); err.putInt("code", error.getCode());
err.putString("errorDetails", error.getDetails()); err.putString("details", error.getDetails());
err.putString("description", error.getMessage()); err.putString("description", error.getMessage());
callback.invoke(err); callback.invoke(err);
} else { } else {
@ -171,11 +171,7 @@ public class RNFirebaseDatabase extends ReactContextBaseJavaModule {
} }
@ReactMethod @ReactMethod
public void on(final String path, public void on(final String path, final String modifiersString, final ReadableArray modifiersArray, final String eventName, final Callback callback) {
final String modifiersString,
final ReadableArray modifiersArray,
final String eventName,
final Callback callback) {
RNFirebaseDatabaseReference ref = this.getDBHandle(path, modifiersArray, modifiersString); RNFirebaseDatabaseReference ref = this.getDBHandle(path, modifiersArray, modifiersString);
if (eventName.equals("value")) { if (eventName.equals("value")) {
@ -192,10 +188,10 @@ public class RNFirebaseDatabase extends ReactContextBaseJavaModule {
@ReactMethod @ReactMethod
public void once(final String path, public void once(final String path,
final String modifiersString, final String modifiersString,
final ReadableArray modifiersArray, final ReadableArray modifiersArray,
final String eventName, final String eventName,
final Callback callback) { final Callback callback) {
RNFirebaseDatabaseReference ref = this.getDBHandle(path, modifiersArray, modifiersString); RNFirebaseDatabaseReference ref = this.getDBHandle(path, modifiersArray, modifiersString);
ref.addOnceValueEventListener(callback); ref.addOnceValueEventListener(callback);
} }
@ -328,8 +324,8 @@ public class RNFirebaseDatabase extends ReactContextBaseJavaModule {
final DatabaseError databaseError) { final DatabaseError databaseError) {
if (databaseError != null) { if (databaseError != null) {
WritableMap err = Arguments.createMap(); WritableMap err = Arguments.createMap();
err.putInt("errorCode", databaseError.getCode()); err.putInt("code", databaseError.getCode());
err.putString("errorDetails", databaseError.getDetails()); err.putString("details", databaseError.getDetails());
err.putString("description", databaseError.getMessage()); err.putString("description", databaseError.getMessage());
callback.invoke(err); callback.invoke(err);
} else { } else {