Java Code Examples for io.reactivex.rxjava3.core.Single#error()

The following examples show how to use io.reactivex.rxjava3.core.Single#error() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CatnipShardImpl.java    From catnip with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Nonnull
@Override
public Single<ShardConnectState> connect() {
    if(connected) {
        return Single.error(new IllegalStateException("Cannot connect shard twice, redeploy it."));
    }
    connected = true;
    final var result = Single.<ShardConnectState>create(emitter -> message = emitter);
    connectSocket();
    return result;
}
 
Example 2
Source File: MemoryEntityCache.java    From catnip with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
protected <I, T> Single<T> or(final I id, final T data, final T def) {
    if(data == null && def == null) {
        return Single.error(new IllegalArgumentException("No entity for: " + id));
    } else {
        return Single.just(Objects.requireNonNullElse(data, def));
    }
}
 
Example 3
Source File: MemoryEntityCache.java    From catnip with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
protected <I, T> Single<T> or(final I id, final T data) {
    if(data == null) {
        return Single.error(new IllegalArgumentException("No entity for: " + id));
    } else {
        return Single.just(data);
    }
}
 
Example 4
Source File: CustomizableEntityCache.java    From catnip with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Nonnull
@Override
public Single<Guild> guildAsync(final long id) {
    return Single.error(new IllegalArgumentException("No entity with id " + id));
}
 
Example 5
Source File: CustomizableEntityCache.java    From catnip with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Nonnull
@Override
public Single<User> userAsync(final long id) {
    return Single.error(new IllegalArgumentException("No entity with id " + id));
}
 
Example 6
Source File: CustomizableEntityCache.java    From catnip with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Nonnull
@Override
public Single<Presence> presenceAsync(final long id) {
    return Single.error(new IllegalArgumentException("No entity with id " + id));
}
 
Example 7
Source File: CustomizableEntityCache.java    From catnip with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Nonnull
@Override
public Single<Member> memberAsync(final long guildId, final long id) {
    return Single.error(new IllegalArgumentException("No entity with id " + id));
}
 
Example 8
Source File: CustomizableEntityCache.java    From catnip with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Nonnull
@Override
public Single<Role> roleAsync(final long guildId, final long id) {
    return Single.error(new IllegalArgumentException("No entity with id " + id));
}
 
Example 9
Source File: CustomizableEntityCache.java    From catnip with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Nonnull
@Override
public Single<GuildChannel> channelAsync(final long guildId, final long id) {
    return Single.error(new IllegalArgumentException("No entity with id " + id));
}
 
Example 10
Source File: CustomizableEntityCache.java    From catnip with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Nonnull
@Override
public Single<UserDMChannel> dmChannelAsync(final long id) {
    return Single.error(new IllegalArgumentException("No entity with id " + id));
}
 
Example 11
Source File: CustomizableEntityCache.java    From catnip with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Nonnull
@Override
public Single<CustomEmoji> emojiAsync(final long guildId, final long id) {
    return Single.error(new IllegalArgumentException("No entity with id " + id));
}
 
Example 12
Source File: CustomizableEntityCache.java    From catnip with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Nonnull
@Override
public Single<VoiceState> voiceStateAsync(final long guildId, final long id) {
    return Single.error(new IllegalArgumentException("No entity with id " + id));
}
 
Example 13
Source File: CustomizableEntityCache.java    From catnip with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Nonnull
@Override
public Single<User> selfUserAsync() {
    return Single.error(new IllegalArgumentException("No entity"));
}