Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
hub passes scope to client
  • Loading branch information
marandaneto committed Oct 19, 2020
commit a46e14460d30142a9c47ecf372672738356671ee
8 changes: 5 additions & 3 deletions dart/lib/src/client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -197,12 +197,13 @@ abstract class SentryClient {
}

/// Reports the [throwable] and optionally its [stackTrace] to Sentry.io.
Future<SentryId> captureException(dynamic throwable, {dynamic stackTrace}) {
Future<SentryId> captureException(dynamic throwable,
{dynamic stackTrace, Scope scope}) {
final event = Event(
exception: throwable,
stackTrace: stackTrace,
);
return captureEvent(event);
return captureEvent(event, scope: scope);
}

/// Reports the [template]
Expand All @@ -211,12 +212,13 @@ abstract class SentryClient {
SeverityLevel level = SeverityLevel.info,
String template,
List<dynamic> params,
Scope scope,
}) {
final event = Event(
message: Message(formatted, template: template, params: params),
level: level,
);
return captureEvent(event);
return captureEvent(event, scope: scope);
}

Future<void> close() async {
Expand Down
19 changes: 7 additions & 12 deletions dart/lib/src/hub.dart
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,8 @@ class Hub {
final item = _peek();
if (item != null) {
try {
// TODO pass the scope
sentryId = await item.client.captureException(
throwable,
stackTrace: stackTrace,
);
sentryId = await item.client.captureException(throwable,
stackTrace: stackTrace, scope: item.scope);
} catch (err) {
_options.logger(
SeverityLevel.error,
Expand Down Expand Up @@ -166,13 +163,11 @@ class Hub {
final item = _peek();
if (item != null) {
try {
// TODO pass the scope
sentryId = await item.client.captureMessage(
message,
level: level,
template: template,
params: params,
);
sentryId = await item.client.captureMessage(message,
level: level,
template: template,
params: params,
scope: item.scope);
} catch (err) {
_options.logger(
SeverityLevel.error,
Expand Down
2 changes: 2 additions & 0 deletions dart/lib/src/protocol/sentry_id.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ class SentryId {
/// The ID Sentry.io assigned to the submitted event for future reference.
final String _id;

// TODO: should we generate the new UUID here with an empty ctor?
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if so, we'd need to import the uuid dependency and make the _id of its type

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I maybe missed it, but I didn't found a method to generate a Uuid from String in the uuid package

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I created a task for it


const SentryId(this._id);

factory SentryId.empty() => SentryId(_emptyId);
Expand Down