Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
.flatMapError((error) => {
// TODO propagate this
Logger.info(new Bacon.Error(`Cannot load configuration from ${conf.CONFIGURATION_FILE}\n${error.message}`));
return {};
});
}
SongModel.searchOnSpotify = function() {
return Bacon.once(new Bacon.Error());
};
return s_addons.flatMapLatest((addons) => {
const filtered_addons = _.filter(addons, ({ name, realId }) => {
return name === addonName || realId === addonName;
});
if (filtered_addons.length === 1) {
return Bacon.once(filtered_addons[0]);
}
if (filtered_addons.length === 0) {
return Bacon.once(new Bacon.Error('Addon not found'));
}
return Bacon.once(new Bacon.Error('Ambiguous addon name'));
});
}
const s_app = s_apps.flatMapLatest(function (apps) {
const filtered_apps = _.filter(apps, function (app) {
return app.name === name;
});
if (filtered_apps.length === 1) {
return Bacon.once(filtered_apps[0]);
}
else if (filtered_apps.length === 0) {
return Bacon.once(new Bacon.Error('Application not found'));
}
else {
return Bacon.once(new Bacon.Error('Ambiguous application name'));
}
});
export function parseResponse(res) {
const contentType = res.headers.get("Content-Type");
const mimeType = contentType && contentType.split(";")[0];
const isJson = mimeType === "application/json";
return res.ok && isJson
? Bacon.fromPromise(res.json())
: res.ok
? Bacon.once(res)
: Bacon.once(new Bacon.Error(res));
}
.flatMapLatest((providers) => {
const provider = _.find(providers, { id: providerName });
return provider || new Bacon.Error('invalid provider name');
});
}
const SCREENSHOT_LIMIT_ERROR = () => new Bacon.Error('Screenshot limit reached!')
const fileTypes = ['image/png', 'image/jpeg']
onmessage: function(message) {
try {
var data = JSON.parse(message.data);
sink(data.type === "song" ? data.song : new Bacon.Error(data.error));
}
catch(e) {
sink(new Bacon.Error(e));
}
},
onerror: function(error) {
onError: (error) => sink(new Bacon.Error(error)),
infinite: false,
ws.on('error', () => {
Logger.debug('WebSocket error.');
stopPing();
sink(new Bacon.Error('WebSocket error.'));
});