1
0
mirror of https://github.com/go-vikunja/app synced 2024-11-08 22:08:10 +00:00

Add sentry (#43)

Refactor DSN to constants

Use correct import

Add sentry

Co-authored-by: Jonas Franz <info@jonasfranz.software>
Reviewed-on: vikunja/app#43
Reviewed-by: konrad <konrad@kola-entertainments.de>
This commit is contained in:
JonasFranz 2020-06-17 15:37:42 +00:00 committed by konrad
parent 4adee85d62
commit 9c2622e77f
4 changed files with 73 additions and 20 deletions

2
lib/constants.dart Normal file

@ -0,0 +1,2 @@
const SENTRY_DSN =
'https://ab786a1feac7418d87187465b6f30ee0@sentry.k8s.jfdev.de/2';

@ -1,12 +1,48 @@
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:sentry/sentry.dart';
import 'package:vikunja_app/constants.dart';
import 'package:vikunja_app/global.dart';
import 'package:vikunja_app/pages/home.dart';
import 'package:vikunja_app/pages/user/login.dart';
import 'package:vikunja_app/theme/theme.dart';
void main() => runApp(VikunjaGlobal(
child: new VikunjaApp(home: HomePage()),
login: new VikunjaApp(home: LoginPage())));
void main() {
var sentry = new SentryClient(dsn: SENTRY_DSN);
FlutterError.onError = (details, {bool forceReport = false}) {
try {
sentry.captureException(
exception: details.exception,
stackTrace: details.stack,
);
} catch (e) {
print('Sending report to sentry.io failed: $e');
} finally {
// Also use Flutter's pretty error logging to the device's console.
FlutterError.dumpErrorToConsole(details, forceReport: forceReport);
}
};
runZoned(
() => runApp(VikunjaGlobal(
child: new VikunjaApp(home: HomePage()),
login: new VikunjaApp(home: LoginPage()))),
onError: (Object error, StackTrace stackTrace) {
try {
sentry.captureException(
exception: error,
stackTrace: stackTrace,
);
print('Error sent to sentry.io: $error');
} catch (e) {
print('Sending report to sentry.io failed: $e');
print('Original error: $error');
}
},
);
}
class VikunjaApp extends StatelessWidget {
final Widget home;

@ -14,42 +14,42 @@ packages:
name: archive
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.11"
version: "2.0.13"
args:
dependency: transitive
description:
name: args
url: "https://pub.dartlang.org"
source: hosted
version: "1.5.2"
version: "1.6.0"
async:
dependency: transitive
description:
name: async
url: "https://pub.dartlang.org"
source: hosted
version: "2.4.0"
version: "2.4.1"
boolean_selector:
dependency: transitive
description:
name: boolean_selector
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.5"
version: "2.0.0"
charcode:
dependency: transitive
description:
name: charcode
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.2"
version: "1.1.3"
collection:
dependency: transitive
description:
name: collection
url: "https://pub.dartlang.org"
source: hosted
version: "1.14.11"
version: "1.14.12"
convert:
dependency: transitive
description:
@ -63,7 +63,7 @@ packages:
name: crypto
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.3"
version: "2.1.4"
cupertino_icons:
dependency: "direct main"
description:
@ -98,7 +98,7 @@ packages:
name: flutter_secure_storage
url: "https://pub.dartlang.org"
source: hosted
version: "3.3.1+1"
version: "3.3.3"
flutter_test:
dependency: "direct dev"
description: flutter
@ -110,7 +110,7 @@ packages:
name: http
url: "https://pub.dartlang.org"
source: hosted
version: "0.12.0+3"
version: "0.12.1"
http_parser:
dependency: transitive
description:
@ -124,7 +124,7 @@ packages:
name: image
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.4"
version: "2.1.12"
matcher:
dependency: transitive
description:
@ -166,7 +166,14 @@ packages:
name: quiver
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.5"
version: "2.1.3"
sentry:
dependency: "direct main"
description:
name: sentry
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.1"
sky_engine:
dependency: transitive
description: flutter
@ -178,7 +185,7 @@ packages:
name: source_span
url: "https://pub.dartlang.org"
source: hosted
version: "1.5.5"
version: "1.7.0"
stack_trace:
dependency: transitive
description:
@ -213,7 +220,7 @@ packages:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.11"
version: "0.2.15"
typed_data:
dependency: transitive
description:
@ -221,6 +228,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.6"
usage:
dependency: transitive
description:
name: usage
url: "https://pub.dartlang.org"
source: hosted
version: "3.4.1"
vector_math:
dependency: transitive
description:
@ -234,7 +248,7 @@ packages:
name: xml
url: "https://pub.dartlang.org"
source: hosted
version: "3.5.0"
version: "3.6.1"
yaml:
dependency: transitive
description:
@ -243,4 +257,4 @@ packages:
source: hosted
version: "2.2.0"
sdks:
dart: ">=2.4.0 <3.0.0"
dart: ">=2.6.0 <3.0.0"

@ -10,9 +10,10 @@ dependencies:
flutter:
sdk: flutter
cupertino_icons: ^0.1.3
flutter_secure_storage: 3.3.1+1
http: 0.12.0+3
flutter_secure_storage: ^3.3.3
http: ^0.12.1
after_layout: ^1.0.7
sentry: ^3.0.1
dev_dependencies:
flutter_test: