-
-
Notifications
You must be signed in to change notification settings - Fork 277
Feat : add a Hub class #113
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
6a5d2c3
4f01775
ea5c55f
bd09da0
c5317a4
6a8910e
f5d3dd0
f102ac3
055b9b0
370d2d5
974d1f6
c8c1df0
6c6c649
a924040
823c91c
b04d67c
37cf83c
b9f9f9e
5067a36
54729ba
729d6bc
4ea1537
5932534
97f6c53
e89c488
647f1b0
91f709a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- feedbacks : remove the IHub interface - client.captureEvent define event as a required param - pass the scope to client.captureEvent(...)
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| import 'dart:async'; | ||
|
|
||
| import 'package:http/src/client.dart'; | ||
|
|
||
| import 'client.dart'; | ||
| import 'protocol.dart'; | ||
|
|
||
| class NoOpSentryClient implements SentryClient { | ||
| @override | ||
| User userContext; | ||
|
|
||
| @override | ||
| List<int> bodyEncoder( | ||
| Map<String, dynamic> data, | ||
| Map<String, String> headers, | ||
| ) => | ||
| []; | ||
|
|
||
| @override | ||
| Map<String, String> buildHeaders(String authHeader) => {}; | ||
|
|
||
| @override | ||
| Future<SentryId> captureEvent(Event event, {stackFrameFilter, scope}) => | ||
| Future.value(SentryId.empty()); | ||
|
|
||
| @override | ||
| Future<SentryId> captureException(throwable, {stackTrace}) => | ||
| Future.value(SentryId.empty()); | ||
|
|
||
| @override | ||
| Future<SentryId> captureMessage( | ||
| Message message, { | ||
| SeverityLevel level = SeverityLevel.info, | ||
| }) => | ||
| Future.value(SentryId.empty()); | ||
|
|
||
| @override | ||
| String get clientId => 'No-op'; | ||
|
|
||
| @override | ||
| Future<void> close() async { | ||
| return; | ||
| } | ||
|
|
||
| @override | ||
| Uri get dsnUri => null; | ||
|
|
||
| @override | ||
| Event get environmentAttributes => null; | ||
|
|
||
| @override | ||
| Client get httpClient => null; | ||
|
|
||
| @override | ||
| String get origin => null; | ||
|
|
||
| @override | ||
| String get postUri => null; | ||
|
|
||
| @override | ||
| String get projectId => null; | ||
|
|
||
| @override | ||
| String get publicKey => null; | ||
|
|
||
| @override | ||
| Sdk get sdk => null; | ||
|
|
||
| @override | ||
| String get secretKey => null; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,7 @@ | ||
| import 'dart:collection'; | ||
|
|
||
| import 'package:collection/collection.dart'; | ||
|
|
||
| import 'protocol.dart'; | ||
| import 'sentry_options.dart'; | ||
|
|
||
|
|
@@ -136,4 +138,28 @@ class Scope { | |
| void removeExtra(String key) { | ||
| _extra.remove(key); | ||
| } | ||
|
|
||
| @override | ||
| bool operator ==(Object other) => | ||
| identical(this, other) || | ||
| other is Scope && | ||
| runtimeType == other.runtimeType && | ||
| _level == other.level && | ||
| _transaction == other.transaction && | ||
| _user == other.user && | ||
| IterableEquality().equals(_fingerprint, other.fingerprint) && | ||
| IterableEquality().equals(_breadcrumbs, other.breadcrumbs) && | ||
| MapEquality().equals(_tags, other.tags) && | ||
| MapEquality().equals(_extra, other.extra); | ||
|
|
||
| @override | ||
| int get hashCode => | ||
| _level.hashCode ^ | ||
| _transaction.hashCode ^ | ||
| _user.hashCode ^ | ||
| _fingerprint.hashCode ^ | ||
| _breadcrumbs.hashCode ^ | ||
| _tags.hashCode ^ | ||
| _extra.hashCode ^ | ||
| _options.hashCode; | ||
|
||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,13 +4,15 @@ import 'package:sentry/src/protocol.dart'; | |
|
|
||
| class MockSentryClient extends Mock implements SentryClient {} | ||
|
|
||
| final fakeDns = 'https://[email protected]/1234567'; | ||
| final fakeDsn = 'https://[email protected]/1234567'; | ||
|
|
||
| final fakeException = Exception('Error'); | ||
|
|
||
| final fakeMessage = | ||
| Message(formatted: 'message 1', message: 'message %d', params: ['1']); | ||
|
|
||
| final fakeUser = User(id: '1', email: 'test@test'); | ||
|
|
||
| final fakeEvent = Event( | ||
| loggerName: 'main', | ||
| serverName: 'server.dart', | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.