mirror of
https://github.com/TeamPiped/Piped-Backend
synced 2025-09-05 21:11:05 +02:00
Log path only when exception is logged.
This commit is contained in:
parent
4bbb7c11ed
commit
e629121c25
@ -301,8 +301,7 @@ public class ServerLauncher extends MultithreadedHttpServerLauncher {
|
|||||||
|
|
||||||
private @NotNull HttpResponse getErrorResponse(Exception e, String path) {
|
private @NotNull HttpResponse getErrorResponse(Exception e, String path) {
|
||||||
|
|
||||||
System.err.println("An error occoured in the path: " + path);
|
e = ExceptionHandler.handle(e, path);
|
||||||
e = ExceptionHandler.handle(e);
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return getJsonResponse(500, Constants.mapper
|
return getJsonResponse(500, Constants.mapper
|
||||||
|
@ -10,13 +10,20 @@ import org.schabi.newpipe.extractor.exceptions.GeographicRestrictionException;
|
|||||||
public class ExceptionHandler {
|
public class ExceptionHandler {
|
||||||
|
|
||||||
public static Exception handle(Exception e) {
|
public static Exception handle(Exception e) {
|
||||||
|
return handle(e, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Exception handle(Exception e, String path) {
|
||||||
|
|
||||||
if (e.getCause() != null && (e instanceof ExecutionException || e instanceof CompletionException))
|
if (e.getCause() != null && (e instanceof ExecutionException || e instanceof CompletionException))
|
||||||
e = (Exception) e.getCause();
|
e = (Exception) e.getCause();
|
||||||
|
|
||||||
if (!(e instanceof AgeRestrictedContentException || e instanceof ContentNotAvailableException
|
if (!(e instanceof AgeRestrictedContentException || e instanceof ContentNotAvailableException
|
||||||
|| e instanceof GeographicRestrictionException))
|
|| e instanceof GeographicRestrictionException)) {
|
||||||
|
if (path != null)
|
||||||
|
System.err.println("An error occoured in the path: " + path);
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user