Skip to content
This repository was archived by the owner on Dec 29, 2025. It is now read-only.

Commit 2dc828e

Browse files
authored
Update FileUtils.java
1 parent a32ed41 commit 2dc828e

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

src/main/java/id.my.alvinq.prokitid.libs/FileUtils.java

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,14 @@ public class FileUtils {
99
public static void copyFile(String from, String to) {
1010
try {
1111
Files.copy(Paths.get(from), Paths.get(to), StandardCopyOption.REPLACE_EXISTING);
12-
} catch (IOException error) {}
12+
} catch (Exception error) {
13+
Throwable real = (e instanceof InvocationTargetException)
14+
? ((InvocationTargetException) e).getCause()
15+
: e;
16+
String errorLog = getStackTraceAsString(real);
17+
Toast.makeText(context, errorLog, Toast.LENGTH_LONG).show();
18+
Logger.get().error("Error!: " + errorLog);
19+
}
1320
}
1421

1522
public static void copyFolder(String source, String target) {
@@ -33,6 +40,13 @@ public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IO
3340
return FileVisitResult.CONTINUE;
3441
}
3542
});
36-
} catch (IOException error) {}
43+
} catch (IOException error) {
44+
Throwable real = (e instanceof InvocationTargetException)
45+
? ((InvocationTargetException) e).getCause()
46+
: e;
47+
String errorLog = getStackTraceAsString(real);
48+
Toast.makeText(context, errorLog, Toast.LENGTH_LONG).show();
49+
Logger.get().error("Error!: " + errorLog);
50+
}
3751
}
3852
}

0 commit comments

Comments
 (0)