Merge branch 'release/3.5.3'
This commit is contained in:
@@ -5,6 +5,16 @@ import Bugsnag from '@bugsnag/js';
|
|||||||
|
|
||||||
declare const __VERSION__: string;
|
declare const __VERSION__: string;
|
||||||
|
|
||||||
|
function redactFilePath(line: string): string {
|
||||||
|
const fileName = line.match(/\w+\.(html|js)?.*/)?.[0];
|
||||||
|
const redacted = '<redacted file path>';
|
||||||
|
if (fileName) {
|
||||||
|
return redacted + '/' + fileName;
|
||||||
|
} else {
|
||||||
|
return redacted;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export function startErrorReporting() {
|
export function startErrorReporting() {
|
||||||
if (storage.get(StorageKey.DisableErrorReporting)) {
|
if (storage.get(StorageKey.DisableErrorReporting)) {
|
||||||
SNLog.onError = console.error;
|
SNLog.onError = console.error;
|
||||||
@@ -17,14 +27,51 @@ export function startErrorReporting() {
|
|||||||
appVersion: __VERSION__,
|
appVersion: __VERSION__,
|
||||||
collectUserIp: false,
|
collectUserIp: false,
|
||||||
autoTrackSessions: false,
|
autoTrackSessions: false,
|
||||||
releaseStage: isDev ? 'development' : undefined
|
releaseStage: isDev ? 'development' : undefined,
|
||||||
|
onError(event) {
|
||||||
|
/**
|
||||||
|
* Redact any data that could be used to identify user,
|
||||||
|
* such as file paths.
|
||||||
|
*/
|
||||||
|
if (isDesktopApplication()) {
|
||||||
|
if (event.context) {
|
||||||
|
event.context = `Desktop/${redactFilePath(event.context)}`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event.request.url?.includes('file:')) {
|
||||||
|
event.request.url = redactFilePath(event.request.url);
|
||||||
|
}
|
||||||
|
|
||||||
|
const originalStack = event.originalError.stack;
|
||||||
|
if (
|
||||||
|
typeof originalStack === 'string' &&
|
||||||
|
originalStack.includes('file:')
|
||||||
|
) {
|
||||||
|
event.originalError.stack = originalStack
|
||||||
|
.split('\n')
|
||||||
|
.map((line) =>
|
||||||
|
line.includes('file:') ? redactFilePath(line) : line
|
||||||
|
)
|
||||||
|
.join('\n');
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const error of event.errors) {
|
||||||
|
for (const stackFrame of error.stacktrace) {
|
||||||
|
if (stackFrame.file.includes('file:')) {
|
||||||
|
stackFrame.file = redactFilePath(stackFrame.file);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
if (isDev) {
|
if (isDev) {
|
||||||
SNLog.onError = console.error;
|
SNLog.onError = console.error;
|
||||||
} else {
|
} else {
|
||||||
SNLog.onError = (error) => {
|
SNLog.onError = (error) => {
|
||||||
Bugsnag.notify(error);
|
Bugsnag.notify(error);
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Failed to start Bugsnag.', error);
|
console.error('Failed to start Bugsnag.', error);
|
||||||
|
|||||||
2
package-lock.json
generated
2
package-lock.json
generated
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "standard-notes-web",
|
"name": "standard-notes-web",
|
||||||
"version": "3.5.2",
|
"version": "3.5.3",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "standard-notes-web",
|
"name": "standard-notes-web",
|
||||||
"version": "3.5.2",
|
"version": "3.5.3",
|
||||||
"license": "AGPL-3.0-or-later",
|
"license": "AGPL-3.0-or-later",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
|||||||
Reference in New Issue
Block a user