Skip to content

Commit 777b69f

Browse files
Ron RadtkeRon Radtke
authored andcommitted
adding promise resolve / reject
1 parent 4ceca95 commit 777b69f

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

android/src/main/java/com/ReactNativeBlobUtil/ReactNativeBlobUtilMediaCollection.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,15 +152,16 @@ public static void writeToMediaFile(Uri fileUri, String data, Promise promise) {
152152
appCtx.getContentResolver().update(fileUri, contentValues, null, null);
153153
stream = resolver.openOutputStream(fileUri);
154154
if (stream == null) {
155-
throw new IOException("Failed to get output stream.");
155+
promise.reject(new IOException("Failed to get output stream."));
156156
}
157157
} catch (IOException e) {
158158
// Don't leave an orphan entry in the MediaStore
159159
resolver.delete(uri, null, null);
160-
throw e;
160+
promise.reject(e);
161161
} finally {
162162
if (stream != null) {
163163
stream.close();
164+
promise.resolve("");
164165
}
165166
}
166167

0 commit comments

Comments
 (0)