public static Optional<PlayerError> createMusicPlayerError(Identification source, String error) {
        if (error == null || error.isEmpty())
            return Optional.empty();
        try {
            PlayerError playerError = new PlayerError(source);
            playerError.addResource(new MusicErrorResource(source, error));
            return Optional.of(playerError);
        } catch (IllegalArgumentException e) {
            return Optional.empty();
        }
    }
public static Optional < PlayerError > createMusicPlayerError ( Identification source , String error ) { if ( error == null || error . isEmpty ( ) ) return Optional . empty ( ) ; try { PlayerError playerError = new PlayerError ( source ) ; playerError . addResource ( new MusicErrorResource ( source , error ) ) ; return Optional . of ( playerError ) ; } catch ( IllegalArgumentException e ) { return Optional . empty ( ) ; } }
creates a new MusicPlayerError
@param source the source
@param error the error (not null and not empty)
@return the optional event