Skip to content

Commit d516378

Browse files
committed
move sentry packages
asked here getsentry/sentry-dart#22 (comment) move the current sentry packages without modifications, except fixing warnings due to new analysis_options.
1 parent 95433c1 commit d516378

20 files changed

Lines changed: 1498 additions & 1 deletion

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,5 @@ These are the available packages in this repository.
3333
| Plugin | Pub |
3434
|--------|-----|
3535
| [palette_generator](./packages/palette_generator/) | [![pub package](https://img.shields.io/pub/v/palette_generator.svg)](https://pub.dartlang.org/packages/palette_generator) |
36-
36+
| [multicast_dns](./packages/multicast_dns/) | [![pub package](https://img.shields.io/pub/v/multicast_dns.svg)](https://pub.dartlang.org/packages/multicast_dns) |
37+
| [sentry](./packages/sentry/) | [![pub package](https://img.shields.io/pub/v/sentry.svg)](https://pub.dartlang.org/packages/sentry) |

packages/sentry/.gitignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
.DS_Store
2+
.atom/
3+
.packages
4+
.dart_tool/
5+
build/
6+
packages
7+
pubspec.lock
8+
.idea/libraries
9+
.idea/workspace.xml
10+
android/
11+
ios/

packages/sentry/.travis.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
language: dart
2+
dart:
3+
- stable
4+
- dev
5+
script: ./tool/presubmit.sh

packages/sentry/AUTHORS

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Below is a list of people and organizations that have contributed
2+
# to package:sentry. Names should be added to the list like so:
3+
#
4+
# Name/Organization <email address>
5+
6+
Google Inc.
7+
Simon Lightfoot <simon@devangels.london>

packages/sentry/CHANGELOG.md

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# package:sentry changelog
2+
3+
## 2.2.0
4+
5+
- Add a `stackFrameFilter` argument to `SentryClient`'s `capture` method (96be842).
6+
- Clean-up code using pre-Dart 2 API (91c7706, b01ebf8).
7+
8+
## 2.1.1
9+
10+
- Defensively copy internal maps event attributes to
11+
avoid shared mutable state (https://github.com/flutter/sentry/commit/044e4c1f43c2d199ed206e5529e2a630c90e4434)
12+
13+
## 2.1.0
14+
15+
- Support DNS format without secret key.
16+
- Remove dependency on `package:quiver`.
17+
- The `clock` argument to `SentryClient` constructor _should_ now be
18+
`ClockProvider` (but still accepts `Clock` for backwards compatibility).
19+
20+
## 2.0.2
21+
22+
- Add support for user context in Sentry events.
23+
24+
## 2.0.1
25+
26+
- Invert stack frames to be compatible with Sentry's default culprit detection.
27+
28+
## 2.0.0
29+
30+
- Fixed deprecation warnings for Dart 2
31+
- Refactored tests to work with Dart 2
32+
33+
## 1.0.0
34+
35+
- first and last Dart 1-compatible release (we may fix bugs on a separate branch if there's demand)
36+
- fix code for Dart 2
37+
38+
## 0.0.6
39+
40+
- use UTC in the `timestamp` field
41+
42+
## 0.0.5
43+
44+
- remove sub-seconds from the timestamp
45+
46+
## 0.0.4
47+
48+
- parse and report async gaps in stack traces
49+
50+
## 0.0.3
51+
52+
- environment attributes
53+
- auto-generate event_id and timestamp for events
54+
55+
## 0.0.2
56+
57+
- parse and report stack traces
58+
- use x-sentry-error HTTP response header
59+
- gzip outgoing payloads by default
60+
61+
## 0.0.1
62+
63+
- basic ability to send exception reports to Sentry.io

packages/sentry/LICENSE

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// Copyright 2014 The Chromium Authors. All rights reserved.
2+
//
3+
// Redistribution and use in source and binary forms, with or without
4+
// modification, are permitted provided that the following conditions are
5+
// met:
6+
//
7+
// * Redistributions of source code must retain the above copyright
8+
// notice, this list of conditions and the following disclaimer.
9+
// * Redistributions in binary form must reproduce the above
10+
// copyright notice, this list of conditions and the following disclaimer
11+
// in the documentation and/or other materials provided with the
12+
// distribution.
13+
// * Neither the name of Google Inc. nor the names of its
14+
// contributors may be used to endorse or promote products derived from
15+
// this software without specific prior written permission.
16+
//
17+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18+
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19+
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20+
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21+
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22+
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23+
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24+
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25+
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26+
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27+
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

packages/sentry/PATENTS

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
Google hereby grants to you a perpetual, worldwide, non-exclusive,
2+
no-charge, royalty-free, irrevocable (except as stated in this
3+
section) patent license to make, have made, use, offer to sell, sell,
4+
import, transfer, and otherwise run, modify and propagate the contents
5+
of this implementation, where such license applies only to those
6+
patent claims, both currently owned by Google and acquired in the
7+
future, licensable by Google that are necessarily infringed by this
8+
implementation. This grant does not include claims that would be
9+
infringed only as a consequence of further modification of this
10+
implementation. If you or your agent or exclusive licensee institute
11+
or order or agree to the institution of patent litigation or any other
12+
patent enforcement activity against any entity (including a
13+
cross-claim or counterclaim in a lawsuit) alleging that this
14+
implementation constitutes direct or contributory patent infringement,
15+
or inducement of patent infringement, then any patent rights granted
16+
to you under this License for this implementation shall terminate as
17+
of the date such litigation is filed.

packages/sentry/README.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# Sentry.io client for Dart
2+
3+
[![Build Status](https://travis-ci.org/flutter/sentry.svg?branch=master)](https://travis-ci.org/flutter/sentry)
4+
5+
Use this library in your Dart programs (Flutter, command-line and (TBD) AngularDart) to report errors thrown by your
6+
program to https://sentry.io error tracking service.
7+
8+
## Versions
9+
10+
`>=0.0.0 <2.0.0` is the range of versions compatible with Dart 1.
11+
12+
`>=2.0.0 <3.0.0` is the range of versions compatible with Dart 2.
13+
14+
## Usage
15+
16+
Sign up for a Sentry.io account and get a DSN at http://sentry.io.
17+
18+
Add `sentry` dependency to your `pubspec.yaml`:
19+
20+
```yaml
21+
dependencies:
22+
sentry: any
23+
```
24+
25+
In your Dart code, import `package:sentry/sentry.dart` and create a `SentryClient` using the DSN issued by Sentry.io:
26+
27+
```dart
28+
import 'package:sentry/sentry.dart';
29+
30+
final SentryClient sentry = new SentryClient(dsn: YOUR_DSN);
31+
```
32+
33+
In an exception handler, call `captureException()`:
34+
35+
```dart
36+
main() async {
37+
try {
38+
doSomethingThatMightThrowAnError();
39+
} catch(error, stackTrace) {
40+
await sentry.captureException(
41+
exception: error,
42+
stackTrace: stackTrace,
43+
);
44+
}
45+
}
46+
```
47+
48+
## Tips for catching errors
49+
50+
- use a `try/catch` block
51+
- create a `Zone` with an error handler, e.g. using [runZoned][run_zoned]
52+
- in Flutter, use [FlutterError.onError][flutter_error]
53+
- use `Isolate.current.addErrorListener` to capture uncaught errors in the root zone
54+
55+
[run_zoned]: https://api.dartlang.org/stable/dart-async/runZoned.html
56+
[flutter_error]: https://docs.flutter.io/flutter/foundation/FlutterError/onError.html
57+
58+
## Found a bug?
59+
60+
Please file it at https://github.com/flutter/flutter/issues/new

packages/sentry/bin/test.dart

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
// Copyright 2017 The Chromium Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
import 'dart:async';
6+
import 'dart:io';
7+
8+
import 'package:sentry/sentry.dart';
9+
10+
/// Sends a test exception report to Sentry.io using this Dart client.
11+
Future<Null> main(List<String> rawArgs) async {
12+
if (rawArgs.length != 1) {
13+
stderr.writeln(
14+
'Expected exactly one argument, which is the DSN issued by Sentry.io to your project.');
15+
exit(1);
16+
}
17+
18+
final String dsn = rawArgs.single;
19+
final SentryClient client = SentryClient(dsn: dsn);
20+
21+
try {
22+
await foo();
23+
} catch (error, stackTrace) {
24+
print('Reporting the following stack trace: ');
25+
print(stackTrace);
26+
final SentryResponse response = await client.captureException(
27+
exception: error,
28+
stackTrace: stackTrace,
29+
);
30+
31+
if (response.isSuccessful) {
32+
print('SUCCESS\nid: ${response.eventId}');
33+
} else {
34+
print('FAILURE: ${response.error}');
35+
}
36+
} finally {
37+
await client.close();
38+
}
39+
}
40+
41+
Future<Null> foo() async {
42+
await bar();
43+
}
44+
45+
Future<Null> bar() async {
46+
await baz();
47+
}
48+
49+
Future<Null> baz() async {
50+
throw StateError('This is a test error');
51+
}

0 commit comments

Comments
 (0)