Commit 234f4804 authored by Wilko Manger's avatar Wilko Manger

Report MatrixExceptions better

Also parse Repsonse<dynamic> body better,
if it's json.
parent 20a91bbf
......@@ -16,11 +16,12 @@
// along with Pattle. If not, see <https://www.gnu.org/licenses/>.
import 'dart:async';
import 'dart:convert';
import 'package:chopper/chopper.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter_dotenv/flutter_dotenv.dart';
import 'package:pattle/src/app.dart';
import 'package:matrix_sdk/matrix_sdk.dart' as matrix;
import 'package:sentry/sentry.dart';
import 'package:package_info/package_info.dart';
import 'package:device_info/device_info.dart';
......@@ -35,24 +36,40 @@ Future<void> _reportError(dynamic error, dynamic stackTrace) async {
} else {
if (error is Response) {
var body;
try {
body = json.decode(error.body);
} on FormatException {
body = error.body?.toString();
}
_sentry.capture(
event: Event(
exception: error,
stackTrace: stackTrace,
extra: {
'status_code': error.statusCode,
'body': error.body?.toString(),
'body': body,
'headers': error.headers
}
)
);
return;
} else if (error is matrix.MatrixException) {
_sentry.capture(
event: Event(
exception: error,
stackTrace: stackTrace,
extra: {
'body': error.body,
}
)
);
} else {
_sentry.captureException(
exception: error,
stackTrace: stackTrace,
);
}
_sentry.captureException(
exception: error,
stackTrace: stackTrace,
);
}
}
......
......@@ -215,7 +215,7 @@ packages:
name: matrix_sdk
url: "https://pub.dartlang.org"
source: hosted
version: "0.12.0"
version: "0.12.2"
matrix_sdk_sqflite:
dependency: "direct main"
description:
......
......@@ -12,7 +12,7 @@ dependencies:
injector: ^1.0.6
matrix_sdk: ^0.12.0
matrix_sdk: ^0.12.2
matrix_sdk_sqflite: ^0.8.0
rxdart: ^0.21.0
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment