Skip to content

Commit ebd7b4b

Browse files
committed
feat: add method for retrieving id of the video for which transcript retrieval has failed
1 parent f4be13a commit ebd7b4b

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

lib/src/main/java/io/github/thoroldvix/api/TranscriptRetrievalException.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ public class TranscriptRetrievalException extends Exception {
1010

1111
private static final String ERROR_MESSAGE = "Could not retrieve transcript for the video: %s.\nReason: %s";
1212
private static final String YOUTUBE_WATCH_URL = "https://www.youtube.com/watch?v=";
13+
private final String videoId;
1314

1415
/**
1516
* Constructs a new exception with the specified detail message and cause.
@@ -20,6 +21,7 @@ public class TranscriptRetrievalException extends Exception {
2021
*/
2122
public TranscriptRetrievalException(String videoId, String message, Throwable cause) {
2223
super(buildErrorMessage(videoId, message), cause);
24+
this.videoId = videoId;
2325
}
2426

2527
/**
@@ -30,6 +32,14 @@ public TranscriptRetrievalException(String videoId, String message, Throwable ca
3032
*/
3133
public TranscriptRetrievalException(String videoId, String message) {
3234
super(buildErrorMessage(videoId, message));
35+
this.videoId = videoId;
36+
}
37+
38+
/**
39+
* @return The ID of the video for which the transcript retrieval failed.
40+
*/
41+
public String getVideoId() {
42+
return videoId;
3343
}
3444

3545
/**

0 commit comments

Comments
 (0)