Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
20 changes: 6 additions & 14 deletions src/io/flutter/FlutterUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -111,27 +111,19 @@ public static boolean isAndroidStudio() {
}
}

public static void info(@NotNull Logger logger, @NotNull Exception e) {
info(logger, e, false);
}

public static void info(@NotNull Logger logger, @NotNull Exception e, boolean sanitizePaths) {
public static void info(@NotNull Logger logger, @NotNull String message, @NotNull Exception e, boolean sanitizePaths) {
if (sanitizePaths && FlutterSettings.getInstance().isFilePathLoggingEnabled()) {
logger.info(e);
logger.info(message, e);
} else {
logger.info(e.toString());
logger.info(message);
}
}

public static void warn(@NotNull Logger logger, @NotNull Exception e) {
warn(logger, e, false);
}

public static void warn(@NotNull Logger logger, @NotNull Exception e, boolean sanitizePaths) {
public static void warn(@NotNull Logger logger, @NotNull String message, @NotNull Exception e, boolean sanitizePaths) {
if (sanitizePaths && FlutterSettings.getInstance().isFilePathLoggingEnabled()) {
logger.warn(e);
logger.warn(message, e);
} else {
logger.warn(e.toString());
logger.warn(message);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/io/flutter/editor/FlutterColors.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public boolean isPrimary() {
colors.load(FlutterUtils.class.getResourceAsStream("/flutter/colors/material.properties"));
}
catch (IOException e) {
FlutterUtils.warn(LOG, e);
FlutterUtils.warn(LOG, "Failed to load colors", e, true);
}

colorToName = new HashMap<>();
Expand Down
2 changes: 1 addition & 1 deletion src/io/flutter/editor/FlutterCupertinoColors.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public class FlutterCupertinoColors {
colors.load(FlutterUtils.class.getResourceAsStream("/flutter/colors/cupertino.properties"));
}
catch (IOException e) {
FlutterUtils.warn(LOG, e);
FlutterUtils.warn(LOG, "Failed to load Cupertino colors", e, true);
}

colorToName = new HashMap<>();
Expand Down
2 changes: 1 addition & 1 deletion src/io/flutter/editor/FlutterCupertinoIcons.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public class FlutterCupertinoIcons {
icons.load(FlutterCupertinoIcons.class.getResourceAsStream("/flutter/icons/cupertino.properties"));
}
catch (IOException e) {
FlutterUtils.warn(LOG, e);
FlutterUtils.warn(LOG, "Failed to load cupertino icons", e, true);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/io/flutter/editor/FlutterMaterialIcons.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public class FlutterMaterialIcons {
icons.load(FlutterMaterialIcons.class.getResourceAsStream("/flutter/icons/material.properties"));
}
catch (IOException e) {
FlutterUtils.warn(LOG, e);
FlutterUtils.warn(LOG, "Failed to load material icons", e, true);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/io/flutter/module/FlutterModuleBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ public static void addAndroidModuleFromFile(@NotNull Project project,
}
}
catch (ModuleWithNameAlreadyExists | IOException e) {
FlutterUtils.warn(LOG, e);
FlutterUtils.warn(LOG, "Failed to add Android module", e, true);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/io/flutter/run/FlutterDebugProcess.java
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ private static void suppressDebugViews(@Nullable RunnerLayoutUi ui) {
}
}
catch (ProcessCanceledException e) {
FlutterUtils.warn(LOG, e);
FlutterUtils.warn(LOG, "Failed to suppress debug views", e, true);
throw e;
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/io/flutter/run/LaunchState.java
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ protected RunContentDescriptor launch(@NotNull ExecutionEnvironment env) throws
}
}
catch (IllegalAccessException | InvocationTargetException | NoSuchFieldException | NoSuchMethodException e) {
FlutterUtils.info(LOG, e, true);
FlutterUtils.info(LOG, "Error setting display name", e, true);
}

return descriptor;
Expand Down Expand Up @@ -402,7 +402,7 @@ protected RunContentDescriptor doExecute(@NotNull RunProfileState state, @NotNul
app.shutdownAsync().get();
}
catch (InterruptedException | java.util.concurrent.ExecutionException e) {
FlutterUtils.warn(LOG, e, true);
FlutterUtils.warn(LOG, "Error while shutting down app", e, true);
}
return launchState.launch(env);
}
Expand Down
2 changes: 1 addition & 1 deletion src/io/flutter/run/SdkFields.java
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ public GeneralCommandLine createFlutterSdkRunCommand(
args = ArrayUtil.append(args, "--devtools-server-address=http://" + instance.host() + ":" + instance.port());
}
catch (Exception e) {
FlutterUtils.warn(LOG, e, true);
FlutterUtils.warn(LOG, "Error while starting DevTools", e, true);
}
command = flutterSdk.flutterRun(root, main.getFile(), device, runMode, flutterLaunchMode, project, args);
final GeneralCommandLine commandLine = command.createGeneralCommandLine(project);
Expand Down
6 changes: 3 additions & 3 deletions src/io/flutter/run/SdkRunConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public static class RecursiveDeleter extends SimpleFileVisitor<Path> {
Files.delete(file);
}
catch (IOException e) {
FlutterUtils.warn(LOG, e);
FlutterUtils.warn(LOG, "Unable to delete file: " + name, e, true);
// TODO(jacobr): consider aborting.
}
}
Expand All @@ -117,7 +117,7 @@ public static class RecursiveDeleter extends SimpleFileVisitor<Path> {

@Override
public @NotNull FileVisitResult visitFileFailed(@NotNull Path file, @NotNull IOException exc) {
FlutterUtils.warn(LOG, exc);
FlutterUtils.warn(LOG, "Unable to visit file", exc, true);
return CONTINUE;
}
}
Expand Down Expand Up @@ -187,7 +187,7 @@ public LaunchState getState(@NotNull Executor executor, @NotNull ExecutionEnviro
Files.writeString(cachedParametersPath, json);
}
catch (IOException e) {
FlutterUtils.warn(LOG, e);
FlutterUtils.warn(LOG, "Unable to delete dill or write params", e, true);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/io/flutter/run/daemon/DeviceDaemon.java
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ else if (attempts == DeviceDaemon.RESTART_ATTEMPTS_BEFORE_WARNING + 4) {
}
catch (java.util.concurrent.ExecutionException e) {
// This is not a user facing crash - we log (and no devices will be discovered).
FlutterUtils.warn(LOG, e, true);
FlutterUtils.warn(LOG, "Error while starting device daemon", e, true);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/io/flutter/sdk/FlutterSdk.java
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ public PubRoot createFiles(@NotNull VirtualFile baseDir, @Nullable Module module
}
}
catch (InterruptedException e) {
FlutterUtils.warn(LOG, e, true);
FlutterUtils.warn(LOG, "Interruption while waiting for createFiles", e, true);
return null;
}

Expand Down
4 changes: 2 additions & 2 deletions src/io/flutter/utils/IconPreviewGenerator.java
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public void batchConvert(@NotNull String outPath, @NotNull String path, @NotNull
}
}
catch (IOException ex) {
FlutterUtils.warn(LOG, ex);
FlutterUtils.warn(LOG, "Unable to batch convert icons", ex, true);
}
return null;
});
Expand All @@ -114,7 +114,7 @@ private Icon runInGraphicsContext(TripleFunction<BufferedImage, Graphics2D, Font
result = callback.fun(image, graphics, frc);
}
catch (IOException | FontFormatException ex) {
FlutterUtils.warn(LOG, ex);
FlutterUtils.warn(LOG, "Unable to generate icon", ex, true);
}
finally {
if (graphics != null) graphics.dispose();
Expand Down