mirror of
https://github.com/viq/NewsBlur.git
synced 2025-04-13 09:38:09 +00:00
Better error handling for mercury reader.
This commit is contained in:
parent
bf70f2aaf7
commit
c9075cc151
3 changed files with 12 additions and 1 deletions
|
@ -40,7 +40,7 @@ if ENV_PROD
|
|||
app.get "/debug", (req, res) ->
|
||||
throw new Error("Debugging Sentry")
|
||||
|
||||
app.use(Sentry.Handlers.errorHandler())
|
||||
app.use Sentry.Handlers.errorHandler()
|
||||
log.debug "Setting up Sentry debugging: #{process.env.SENTRY_DSN.substr(0, 20)}..."
|
||||
|
||||
log.debug "Starting NewsBlur Node Server: #{process.env.SERVER_NAME || 'localhost'}"
|
||||
|
|
|
@ -31,5 +31,10 @@ original_text = (app) =>
|
|||
Mercury.parse(url).then (result) =>
|
||||
log.debug "Fetched: #{url}"
|
||||
res.end JSON.stringify result
|
||||
.catch (error) =>
|
||||
log.debug "Failed to fetch: #{url}: #{error}"
|
||||
throw new Error("Failed to fetch: #{url}: #{error}")
|
||||
return res.end JSON.stringify error: "Failed to fetch #{url}: #{error}"
|
||||
|
||||
|
||||
exports.original_text = original_text
|
||||
|
|
|
@ -41,6 +41,12 @@
|
|||
return Mercury.parse(url).then((result) => {
|
||||
log.debug(`Fetched: ${url}`);
|
||||
return res.end(JSON.stringify(result));
|
||||
}).catch((error) => {
|
||||
log.debug(`Failed to fetch: ${url}: ${error}`);
|
||||
throw new Error(`Failed to fetch: ${url}: ${error}`);
|
||||
return res.end(JSON.stringify({
|
||||
error: `Failed to fetch ${url}: ${error}`
|
||||
}));
|
||||
});
|
||||
});
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue