mirror of
https://github.com/jwdeveloper/TikTokLiveJava.git
synced 2026-03-02 02:09:40 -05:00
Changes:
- Implementation on all features in `clientSettings` - Code optimization - More detail exceptions - Downloading gifts
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
package io.github.jwdeveloper.tiktok.exceptions;
|
||||
|
||||
import io.github.jwdeveloper.tiktok.messages.WebcastResponse;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.Base64;
|
||||
|
||||
public class TikTokLiveMessageException extends TikTokLiveException {
|
||||
|
||||
@Getter
|
||||
private final WebcastResponse.Message webcastMessage;
|
||||
@Getter
|
||||
private final WebcastResponse webcastResponse;
|
||||
|
||||
|
||||
public TikTokLiveMessageException(WebcastResponse.Message message,
|
||||
WebcastResponse webcastResponse,
|
||||
Throwable cause) {
|
||||
super("Error while handling Message: " + message.getType() + ": \n", cause);
|
||||
this.webcastMessage = message;
|
||||
this.webcastResponse = webcastResponse;
|
||||
}
|
||||
|
||||
public void messageToBase64()
|
||||
{
|
||||
var decoded = Base64.getEncoder().encodeToString(webcastMessage.getBinary().toByteArray());
|
||||
}
|
||||
|
||||
public void webcastResponseToBase64()
|
||||
{
|
||||
var decoded = Base64.getEncoder().encodeToString(webcastResponse.toByteArray());
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
package io.github.jwdeveloper.tiktok.exceptions;
|
||||
|
||||
public class TikTokLiveMessageParsingException extends TikTokLiveException
|
||||
{
|
||||
public TikTokLiveMessageParsingException() {
|
||||
}
|
||||
|
||||
public TikTokLiveMessageParsingException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public TikTokLiveMessageParsingException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
public TikTokLiveMessageParsingException(Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
|
||||
public TikTokLiveMessageParsingException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
|
||||
super(message, cause, enableSuppression, writableStackTrace);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package io.github.jwdeveloper.tiktok.exceptions;
|
||||
|
||||
public class TikTokLiveOfflineHostException extends TikTokLiveException
|
||||
{
|
||||
public TikTokLiveOfflineHostException(String message) {
|
||||
super(message);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package io.github.jwdeveloper.tiktok.exceptions;
|
||||
|
||||
|
||||
public class TikTokMessageMappingException extends TikTokLiveException
|
||||
{
|
||||
public TikTokMessageMappingException(Class<?> inputClazz, Class<?> outputClass, Throwable throwable)
|
||||
{
|
||||
super("Unable to handle mapping from class: " + inputClazz.getSimpleName() + " to class " + outputClass.getSimpleName(),throwable);
|
||||
}
|
||||
|
||||
public TikTokMessageMappingException(Class<?> inputClazz, Class<?> outputClass, String message)
|
||||
{
|
||||
super("Unable to handle mapping from class: " + inputClazz.getSimpleName() + " to class " + outputClass.getSimpleName()+": "+message);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package io.github.jwdeveloper.tiktok.exceptions;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
public class TikTokProtocolBufferException extends TikTokLiveException
|
||||
{
|
||||
@Getter
|
||||
private final byte[] bytes;
|
||||
|
||||
public TikTokProtocolBufferException(String message, byte[] bytes, Throwable cause)
|
||||
{
|
||||
super(message, cause);
|
||||
this.bytes = bytes;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user