Skip to content

Commit f3233ad

Browse files
committed
Factor out errorCodes for future constants
1 parent 98d873f commit f3233ad

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

Diff for: android/src/main/java/io/fullstack/firestack/FirestackStorage.java

+8-5
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,8 @@ public void onSuccess(final StorageMetadata storageMetadata) {
229229
@Override
230230
public void onFailure(@NonNull Exception exception) {
231231
Log.e(TAG, "Failure in download " + exception);
232-
callback.invoke(makeErrorPayload(1, exception));
232+
final int errorCode = 1;
233+
callback.invoke(makeErrorPayload(errorCode, exception));
233234
}
234235
});
235236

@@ -336,13 +337,14 @@ public void onPaused(UploadTask.TaskSnapshot taskSnapshot) {
336337
StorageMetadata d = taskSnapshot.getMetadata();
337338
String bucket = d.getBucket();
338339
WritableMap data = Arguments.createMap();
339-
data.putString("eventName", "upload_paused");
340+
data.putString("eventName", STORAGE_UPLOAD_PAUSED);
340341
data.putString("ref", bucket);
341-
FirestackUtils.sendEvent(getReactApplicationContext(), "upload_paused", data);
342+
FirestackUtils.sendEvent(getReactApplicationContext(), STORAGE_UPLOAD_PAUSED, data);
342343
}
343344
});
344345
} catch (Exception ex) {
345-
callback.invoke(makeErrorPayload(2, ex));
346+
final int errorCode = 2;
347+
callback.invoke(makeErrorPayload(errorCode, ex));
346348
}
347349
}
348350

@@ -353,7 +355,8 @@ public void getRealPathFromURI(final String uri, final Callback callback) {
353355
callback.invoke(null, path);
354356
} catch (Exception ex) {
355357
ex.printStackTrace();
356-
callback.invoke(makeErrorPayload(1, ex));
358+
final int errorCode = 1;
359+
callback.invoke(makeErrorPayload(errorCode, ex));
357360
}
358361
}
359362

0 commit comments

Comments
 (0)