mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-25 06:42:51 +02:00
Better Error Handling
This commit is contained in:
@@ -29,11 +29,11 @@ module.exports = class GoogleCommand extends Command {
|
||||
.get(`https://www.google.com/search?q=${query}`);
|
||||
const $ = cheerio.load(text);
|
||||
let href = $('.r').first().find('a').first().attr('href');
|
||||
if(!href) throw new Error('No Results');
|
||||
if(!href) throw new Error('No Results.');
|
||||
href = querystring.parse(href.replace('/url?', ''));
|
||||
return message.edit(href.q);
|
||||
} catch(err) {
|
||||
return message.edit('No Results Found.');
|
||||
return message.edit('An Error Occurred: No Results.');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user