Skip to content

Commit

Permalink
Ignore "fromUserOfArticleId does not match any existing articles" in …
Browse files Browse the repository at this point in the history
…rollbar
  • Loading branch information
MrOrz committed Mar 5, 2020
1 parent 65d624a commit 1ba2018
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
4 changes: 4 additions & 0 deletions constants/errors.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
// Matches setup in rumors-api
export const AUTH_ERROR_MSG = 'userId is not set via query string.';

// Matches setup in rumors-api
export const NO_USER_FOR_ARTICLE =
'fromUserOfArticleId does not match any existing articles';
2 changes: 2 additions & 0 deletions lib/rollbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
*/
import Rollbar from 'rollbar';
import getConfig from 'next/config';
import { NO_USER_FOR_ARTICLE } from 'constants/errors';

if (typeof window !== 'undefined') {
throw new Error(
Expand All @@ -25,6 +26,7 @@ const rollbar = new Rollbar({
captureUncaught: true,
captureUnhandledRejections: true,
nodeSourceMaps: true,
ignoredMessages: [NO_USER_FOR_ARTICLE],
});

export default rollbar;
4 changes: 2 additions & 2 deletions pages/_document.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
import Document, { Head, Main, NextScript } from 'next/document';
import getConfig from 'next/config';
import { ServerStyleSheets } from '@material-ui/styles';
import { AUTH_ERROR_MSG } from 'constants/errors';
import { AUTH_ERROR_MSG, NO_USER_FOR_ARTICLE } from 'constants/errors';
import theme from 'lib/theme';
import agent from 'lib/stackimpact';
import rollbar from 'lib/rollbar';
Expand Down Expand Up @@ -60,7 +60,7 @@ class MyDocument extends Document {
captureUncaught: true,
captureUnhandledRejections: true,
payload: { environment: "${PUBLIC_ROLLBAR_ENV}" },
ignoredMessages: ["${AUTH_ERROR_MSG}"],
ignoredMessages: ["${AUTH_ERROR_MSG}", "${NO_USER_FOR_ARTICLE}"],
};
${rollbarSnippet}
`,
Expand Down

0 comments on commit 1ba2018

Please sign in to comment.