-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[PB-458]:(feature) Add Sentry for main and renderer process
- Loading branch information
Showing
8 changed files
with
378 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,3 +14,4 @@ NEW_API_URL= | |
NEW_DRIVE_URL= | ||
RUDDERSTACK_KEY= | ||
RUDDERSTACK_DATA_PLANE_URL= | ||
SENTRY_DSN= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,26 @@ | ||
declare global { | ||
namespace NodeJS { | ||
interface ProcessEnv { | ||
CRYPTO_KEY: string; | ||
MAGIC_IV: string; | ||
MAGIC_SALT: string; | ||
NEW_CRYPTO_KEY: string; | ||
API_URL: string; | ||
DRIVE_URL: string; | ||
BRIDGE_URL: string; | ||
APP_SEGMENT_KEY: string; | ||
APP_SEGMENT_KEY_TEST: string; | ||
BUG_REPORTING_URL: string; | ||
platform: string; | ||
NOTIFICATIONS_URL: string; | ||
LOCK_REFRESH_INTERVAL: string; | ||
PHOTOS_URL: string; | ||
RUDDERSTACK_KEY: string; | ||
RUDDERSTACK_DATA_PLANE_URL: string; | ||
DRIVE_API_URL: string; | ||
} | ||
} | ||
namespace NodeJS { | ||
interface ProcessEnv { | ||
CRYPTO_KEY: string; | ||
MAGIC_IV: string; | ||
MAGIC_SALT: string; | ||
NEW_CRYPTO_KEY: string; | ||
API_URL: string; | ||
DRIVE_URL: string; | ||
BRIDGE_URL: string; | ||
APP_SEGMENT_KEY: string; | ||
APP_SEGMENT_KEY_TEST: string; | ||
BUG_REPORTING_URL: string; | ||
platform: string; | ||
NOTIFICATIONS_URL: string; | ||
LOCK_REFRESH_INTERVAL: string; | ||
PHOTOS_URL: string; | ||
RUDDERSTACK_KEY: string; | ||
RUDDERSTACK_DATA_PLANE_URL: string; | ||
DRIVE_API_URL: string; | ||
SENTRY_DSN: string; | ||
} | ||
} | ||
} | ||
|
||
export {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,26 @@ | ||
import { render } from 'react-dom'; | ||
|
||
import App from './App'; | ||
import { init } from '@sentry/electron/renderer'; | ||
import { init as reactInit } from '@sentry/react'; | ||
|
||
// Initialize Sentry for the Renderer process | ||
// eslint-disable-next-line no-console | ||
console.info('Initializing Sentry for renderer process'); | ||
if (process.env.SENTRY_DSN) { | ||
init( | ||
{ | ||
dsn: process.env.SENTRY_DSN, | ||
debug: true, | ||
}, | ||
reactInit | ||
); | ||
// eslint-disable-next-line no-console | ||
console.info('Sentry is ready for renderer process'); | ||
} else { | ||
// eslint-disable-next-line no-console | ||
console.error( | ||
'Sentry DSN not found, cannot initialize Sentry in renderer process' | ||
); | ||
} | ||
|
||
render(<App />, document.getElementById('root')); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import * as Sentry from '@sentry/electron/renderer'; | ||
|
||
/** | ||
* Reports an error to Sentry from the renderer process | ||
* | ||
* @param error The error to be reported | ||
* @param context The context to attach to the error such the userId, tags, boolean values... | ||
*/ | ||
export const reportError = ( | ||
error: Error, | ||
context: Record<string, string> = {} | ||
) => { | ||
Sentry.captureException(error, context); | ||
}; |
Oops, something went wrong.