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
remove the default options.sdk assignment from clients
  • Loading branch information
rxlabz committed Oct 28, 2020
commit 59a2d7c2c88c6e607fa3bb057527294cdc7f9b5e
11 changes: 3 additions & 8 deletions dart/lib/src/sentry_browser_client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,8 @@
/// A pure Dart client for Sentry.io crash reporting.
import 'dart:html' show window;

import 'protocol.dart';
import 'sentry_client.dart';
import 'sentry_options.dart';
import 'version.dart';

SentryClient createSentryClient(SentryOptions options) =>
SentryBrowserClient(options);
Expand All @@ -25,13 +23,10 @@ class SentryBrowserClient extends SentryClient {
///
/// If [httpClient] is provided, it is used instead of the default client to
/// make HTTP calls to Sentry.io. This is useful in tests.
factory SentryBrowserClient(SentryOptions options) {
options.sdk ??= Sdk(name: sdkName, version: sdkVersion);

// origin is necessary for sentry to resolve stacktrace
return SentryBrowserClient._(options);
}
factory SentryBrowserClient(SentryOptions options) =>
Copy link
Contributor

Choose a reason for hiding this comment

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

make me wonder if now we need to have a SentryBrowserClient and IOClient only because of the origin field.

Copy link
Contributor Author

@rxlabz rxlabz Oct 28, 2020

Choose a reason for hiding this comment

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

true, we could move the origin settings in transport, and use the same strategy as for gzip compression => it will remove the need for 2 clients

SentryBrowserClient._(options);

SentryBrowserClient._(SentryOptions options)
// origin is necessary for sentry to resolve stacktrace
: super.base(options, origin: '${window.location.origin}/');
}
8 changes: 1 addition & 7 deletions dart/lib/src/sentry_io_client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,17 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import 'protocol.dart';

/// A pure Dart client for Sentry.io crash reporting.
import 'sentry_client.dart';
import 'sentry_options.dart';
import 'version.dart';

SentryClient createSentryClient(SentryOptions options) =>
SentryIOClient(options);

/// Logs crash reports and events to the Sentry.io service.
class SentryIOClient extends SentryClient {
/// Instantiates a client using [SentryOptions]
factory SentryIOClient(SentryOptions options) {
options.sdk ??= Sdk(name: sdkName, version: sdkVersion);
return SentryIOClient._(options);
}
factory SentryIOClient(SentryOptions options) => SentryIOClient._(options);

SentryIOClient._(SentryOptions options) : super.base(options);
}