Skip to content

minor cleanup #7

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

Merged
merged 1 commit into from
Mar 2, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
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
19 changes: 8 additions & 11 deletions lib/sentry.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class SentryClient {
/// The default logger name used if no other value is supplied.
static const String defaultLoggerName = 'SentryClient';

/// Instantiates a client using [dns] issued to your project by Sentry.io as
/// Instantiates a client using [dsn] issued to your project by Sentry.io as
/// the endpoint for submitting events.
///
/// [environmentAttributes] contain event attributes that do not change over
Expand Down Expand Up @@ -161,7 +161,7 @@ class SentryClient {
'sentry_secret=$secretKey',
};

Map<String, dynamic> json = <String, dynamic>{
final Map<String, dynamic> json = <String, dynamic>{
'project': projectId,
'event_id': _uuidGenerator(),
'timestamp': formatDateAsIso8601WithSecondPrecision(_clock.now()),
Expand Down Expand Up @@ -221,15 +221,13 @@ class SentryClient {
/// contain the description of the error.
@immutable
class SentryResponse {
SentryResponse.success({@required eventId})
const SentryResponse.success({@required this.eventId})
: isSuccessful = true,
eventId = eventId,
error = null;

SentryResponse.failure(error)
const SentryResponse.failure(this.error)
: isSuccessful = false,
eventId = null,
error = error;
eventId = null;

/// Whether event was submitted successfully.
final bool isSuccessful;
Expand All @@ -243,9 +241,8 @@ class SentryResponse {

typedef UuidGenerator = String Function();

String _generateUuidV4WithoutDashes() {
return new Uuid().generateV4().replaceAll('-', '');
}
String _generateUuidV4WithoutDashes() =>
new Uuid().generateV4().replaceAll('-', '');

/// Severity of the logged [Event].
@immutable
Expand Down Expand Up @@ -276,7 +273,7 @@ class Event {
static const String defaultFingerprint = '{{ default }}';

/// Creates an event.
Event({
const Event({
this.loggerName,
this.serverName,
this.release,
Expand Down
2 changes: 1 addition & 1 deletion lib/src/stack_trace.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const Map<String, dynamic> asynchronousGapFrameJson = const <String, dynamic>{
'abs_path': '<asynchronous suspension>',
};

/// Encodes [strackTrace] as JSON in the Sentry.io format.
/// Encodes [stackTrace] as JSON in the Sentry.io format.
///
/// [stackTrace] must be [String] or [StackTrace].
List<Map<String, dynamic>> encodeStackTrace(dynamic stackTrace) {
Expand Down
2 changes: 1 addition & 1 deletion lib/src/utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ void mergeAttributes(Map<String, dynamic> attributes,
{@required Map<String, dynamic> into}) {
assert(attributes != null && into != null);
attributes.forEach((String name, dynamic value) {
dynamic targetValue = into[name];
final dynamic targetValue = into[name];
if (value is Map && targetValue is Map) {
mergeAttributes(value, into: targetValue);
} else {
Expand Down
8 changes: 4 additions & 4 deletions test/sentry_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ void main() {
clock: fakeClock,
uuidGenerator: () => 'X' * 32,
compressPayload: compressPayload,
environmentAttributes: new Event(
environmentAttributes: const Event(
serverName: 'test.server.com',
release: '1.2.3',
environment: 'staging',
Expand All @@ -65,7 +65,7 @@ void main() {

expect(postUri, client.postUri);

Map<String, String> expectedHeaders = <String, String>{
final Map<String, String> expectedHeaders = <String, String>{
'User-Agent': '$sdkName/$sdkVersion',
'Content-Type': 'application/json',
'X-Sentry-Auth': 'Sentry sentry_version=6, '
Expand All @@ -86,7 +86,7 @@ void main() {
json = JSON.decode(UTF8.decode(body));
}
final Map<String, dynamic> stacktrace = json.remove('stacktrace');
expect(stacktrace['frames'], new isInstanceOf<List>());
expect(stacktrace['frames'], const isInstanceOf<List>());
expect(stacktrace['frames'], isNotEmpty);

final Map<String, dynamic> topFrame = stacktrace['frames'].first;
Expand Down Expand Up @@ -141,7 +141,7 @@ void main() {
clock: fakeClock,
uuidGenerator: () => 'X' * 32,
compressPayload: false,
environmentAttributes: new Event(
environmentAttributes: const Event(
serverName: 'test.server.com',
release: '1.2.3',
environment: 'staging',
Expand Down