-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package io.github.drednote.telegram.exception.type; | ||
|
||
/** | ||
* Exception that throws during scenario processing. | ||
*/ | ||
public class ScenarioException extends TelegramException { | ||
|
||
public ScenarioException(String message) { | ||
super(message); | ||
} | ||
Check warning on line 10 in src/main/java/io/github/drednote/telegram/exception/type/ScenarioException.java Codecov / codecov/patchsrc/main/java/io/github/drednote/telegram/exception/type/ScenarioException.java#L9-L10
|
||
|
||
public ScenarioException(String message, Throwable cause) { | ||
super(message, cause); | ||
} | ||
Check warning on line 14 in src/main/java/io/github/drednote/telegram/exception/type/ScenarioException.java Codecov / codecov/patchsrc/main/java/io/github/drednote/telegram/exception/type/ScenarioException.java#L13-L14
|
||
|
||
public ScenarioException(Throwable cause) { | ||
super(cause); | ||
} | ||
} | ||
Check warning on line 19 in src/main/java/io/github/drednote/telegram/exception/type/ScenarioException.java Codecov / codecov/patchsrc/main/java/io/github/drednote/telegram/exception/type/ScenarioException.java#L17-L19
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package io.github.drednote.telegram.handler.scenario; | ||
|
||
import io.github.drednote.telegram.core.request.UpdateRequest; | ||
import org.springframework.lang.Nullable; | ||
|
||
/** | ||
* Result of a handling event. | ||
* | ||
* @author Ivan Galushko | ||
* @see Scenario#sendEvent(UpdateRequest) | ||
*/ | ||
public interface ScenarioEventResult { | ||
|
||
/** | ||
* @return true if the event was successfully handled, false otherwise. | ||
*/ | ||
boolean success(); | ||
|
||
/** | ||
* @return exception that thrown during scenario processing, null otherwise. | ||
*/ | ||
@Nullable | ||
Exception exception(); | ||
|
||
/** | ||
* Default realization of {@code ScenarioEventResult} | ||
*/ | ||
record SimpleScenarioEventResult( | ||
boolean success, @Nullable Exception exception | ||
) implements ScenarioEventResult {} | ||
} |