Handle error

This commit is contained in:
syuilo
2018-05-18 12:27:00 +09:00
parent e2510e5e3a
commit ec3243da32
3 changed files with 6 additions and 6 deletions

View File

@ -1,3 +1,7 @@
2.0.5 / 2018-05-18
------------------
* Fix bug
2.0.4 / 2018-04-18
------------------
* Dependencies update

View File

@ -1,6 +1,6 @@
{
"name": "summaly",
"version": "2.0.4",
"version": "2.0.5",
"description": "Get web page's summary",
"author": "syuilo <i@syuilo.com>",
"license": "MIT",

View File

@ -44,17 +44,13 @@ const defaultOptions = {
/**
* Summarize an web page
* @param {string} url URL of web page you want to summarize
* @param {Options?} options The options
* @return {Promise<Result>} Promised summary
*/
export default async (url: string, options?: Options): Promise<Result> => {
const opts = Object.assign(defaultOptions, options);
const plugins = builtinPlugins.concat(opts.plugins || []);
// Follow redirects
const actualUrl = opts.followRedirects ? await tracer(url) : url;
const actualUrl = opts.followRedirects ? await tracer(url).catch(() => url) : url;
const _url = URL.parse(actualUrl, true);