diff --git a/app/actions/remote/post.ts b/app/actions/remote/post.ts index 61968e3b10..6bb6d7971b 100644 --- a/app/actions/remote/post.ts +++ b/app/actions/remote/post.ts @@ -436,7 +436,7 @@ export async function fetchPostsBefore(serverUrl: string, channelId: string, pos await operator.batchRecords(models); } catch (error) { - logError('FETCH AUTHORS ERROR', error); + logError('FETCH POSTS BEFORE ERROR', error); } } diff --git a/app/utils/error_handling.ts b/app/utils/error_handling.ts index 2ac1145fda..3a17a1ff07 100644 --- a/app/utils/error_handling.ts +++ b/app/utils/error_handling.ts @@ -16,7 +16,6 @@ import { captureException, captureJSException, initializeSentry, - LOGGER_NATIVE, } from '@utils/sentry'; import {logWarning} from './log'; @@ -31,7 +30,7 @@ class JavascriptAndNativeErrorHandler { nativeErrorHandler = (e: string) => { logWarning('Handling native error ' + e); - captureException(e, LOGGER_NATIVE); + captureException(e); }; errorHandler = (e: Error | ClientError, isFatal: boolean) => { diff --git a/app/utils/sentry.ts b/app/utils/sentry.ts index 44b5e7bb99..346535b8e1 100644 --- a/app/utils/sentry.ts +++ b/app/utils/sentry.ts @@ -2,6 +2,7 @@ // See LICENSE.txt for license information. import {Database} from '@nozbe/watermelondb'; +import Sentry from '@sentry/react-native'; import {Breadcrumb, Event} from '@sentry/types'; import {Platform} from 'react-native'; import {Navigation} from 'react-native-navigation'; @@ -17,22 +18,12 @@ import {logError, logWarning} from './log'; export const BREADCRUMB_UNCAUGHT_APP_ERROR = 'uncaught-app-error'; export const BREADCRUMB_UNCAUGHT_NON_ERROR = 'uncaught-non-error'; -export const LOGGER_EXTENSION = 'extension'; -export const LOGGER_JAVASCRIPT = 'javascript'; -export const LOGGER_JAVASCRIPT_WARNING = 'javascript_warning'; -export const LOGGER_NATIVE = 'native'; - -let Sentry: any; export function initializeSentry() { if (!Config.SentryEnabled) { return; } - if (!Sentry) { - Sentry = require('@sentry/react-native'); - } - const dsn = getDsn(); if (!dsn) { @@ -81,16 +72,16 @@ function getDsn() { return ''; } -export function captureException(error: Error | string, logger: string) { +export function captureException(error: Error | string) { if (!Config.SentryEnabled) { return; } - if (!error || !logger) { - logWarning('captureException called with missing arguments', error, logger); + if (!error) { + logWarning('captureException called with missing arguments', error); return; } - Sentry.captureException(error, {logger}); + Sentry.captureException(error); } export function captureJSException(error: Error | ClientError, isFatal: boolean) { @@ -106,7 +97,7 @@ export function captureJSException(error: Error | ClientError, isFatal: boolean) if (error instanceof ClientError) { captureClientErrorAsBreadcrumb(error, isFatal); } else { - captureException(error, LOGGER_JAVASCRIPT); + captureException(error); } } diff --git a/patches/@nozbe+watermelondb+0.24.0.patch b/patches/@nozbe+watermelondb+0.24.0.patch index 57bce6052f..284f8ede0d 100644 --- a/patches/@nozbe+watermelondb+0.24.0.patch +++ b/patches/@nozbe+watermelondb+0.24.0.patch @@ -27,10 +27,10 @@ index 1a7c99e..0cb7b87 100644 public markAsDeleted(): Promise diff --git a/node_modules/@nozbe/watermelondb/Model/index.js b/node_modules/@nozbe/watermelondb/Model/index.js -index 075a047..75e5936 100644 +index 075a047..5a1604d 100644 --- a/node_modules/@nozbe/watermelondb/Model/index.js +++ b/node_modules/@nozbe/watermelondb/Model/index.js -@@ -78,6 +78,18 @@ var Model = /*#__PURE__*/function () { +@@ -78,10 +78,22 @@ var Model = /*#__PURE__*/function () { // database.batch() ; @@ -49,6 +49,11 @@ index 075a047..75e5936 100644 _proto.prepareUpdate = function prepareUpdate(recordUpdater = _noop.default) { var _this = this; +- (0, _invariant.default)(!this._preparedState, "Cannot update a record with pending changes"); ++ (0, _invariant.default)(!this._preparedState, "Cannot update a record with pending changes in table " + _this.table); + + this.__ensureNotDisposable("Model.prepareUpdate()"); + @@ -92,6 +104,7 @@ var Model = /*#__PURE__*/function () { } // Perform updates