0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-03 23:00:14 -05:00

Added logging of unexpected errors in oembed service

no issue

- if we encounter an unexpected error whilst fetching embed details we return a generic validation error so we're not leaking any details about the URL that is being hit, however that meant the error logs were only showing validation errors making debugging difficult
- added explicit logging of the unexpected error before throwing the generic validation error
This commit is contained in:
Kevin Ansfield 2021-11-17 13:31:10 +00:00
parent bbceace31c
commit ca26c3ab0a

View file

@ -1,5 +1,6 @@
const errors = require('@tryghost/errors');
const tpl = require('@tryghost/tpl');
const logging = require('@tryghost/logging');
const {extract, hasProvider} = require('oembed-parser');
const cheerio = require('cheerio');
const _ = require('lodash');
@ -120,6 +121,9 @@ class OEmbed {
throw err;
}
// log the real error because we're going to throw a generic "Unknown provider" error
logging.error(new errors.GhostError({err}));
// default to unknown provider to avoid leaking any app specifics
return this.unknownProvider(url);
};