Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
changing a use of RuntimeException to a FlutterError
  • Loading branch information
Gray Mackall committed May 8, 2023
commit d5affdd13cab5d9be2d851534441051910ce005b
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,12 @@ public String getTempFilePath(@NonNull String prefix, @NonNull String suffix) {
File path = File.createTempFile(prefix, suffix, context.getCacheDir());
return path.toString();
} catch (IOException | SecurityException e) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you know when these might be expected consider adding a comment.

throw new RuntimeException(e);
throw new GeneratedCameraXLibrary.FlutterError(
"getTempFilePath_failure",
"SystemServicesHostApiImpl.getTempFilePath encountered an exception: "
+ e.toString(),
null
);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ public void getTempFilePath_throwsRuntimeExceptionOnIOException() {
.when(() -> File.createTempFile(prefix, suffix, mockOutputDir))
.thenThrow(IOException.class);
assertThrows(
RuntimeException.class, () -> systemServicesHostApi.getTempFilePath(prefix, suffix));
GeneratedCameraXLibrary.FlutterError.class, () -> systemServicesHostApi.getTempFilePath(prefix, suffix));

mockedStaticFile.close();
}
Expand Down