Skip to content

move sentry packages #17

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

Closed
wants to merge 3 commits into from
Closed
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
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,5 @@ These are the available packages in this repository.
| Plugin | Pub |
|--------|-----|
| [palette_generator](./packages/palette_generator/) | [![pub package](https://img.shields.io/pub/v/palette_generator.svg)](https://pub.dartlang.org/packages/palette_generator) |

| [multicast_dns](./packages/multicast_dns/) | [![pub package](https://img.shields.io/pub/v/multicast_dns.svg)](https://pub.dartlang.org/packages/multicast_dns) |
| [sentry](./packages/sentry/) | [![pub package](https://img.shields.io/pub/v/sentry.svg)](https://pub.dartlang.org/packages/sentry) |
11 changes: 11 additions & 0 deletions packages/sentry/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.DS_Store
.atom/
.packages
.dart_tool/
build/
packages
pubspec.lock
.idea/libraries
.idea/workspace.xml
android/
ios/
5 changes: 5 additions & 0 deletions packages/sentry/.travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
language: dart
dart:
- stable
- dev
script: ./tool/presubmit.sh
7 changes: 7 additions & 0 deletions packages/sentry/AUTHORS
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Below is a list of people and organizations that have contributed
# to package:sentry. Names should be added to the list like so:
#
# Name/Organization <email address>

Google Inc.
Simon Lightfoot <[email protected]>
63 changes: 63 additions & 0 deletions packages/sentry/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# package:sentry changelog

## 2.2.0

- Add a `stackFrameFilter` argument to `SentryClient`'s `capture` method (96be842).
- Clean-up code using pre-Dart 2 API (91c7706, b01ebf8).

## 2.1.1

- Defensively copy internal maps event attributes to
avoid shared mutable state (https://github.com/flutter/sentry/commit/044e4c1f43c2d199ed206e5529e2a630c90e4434)

## 2.1.0

- Support DNS format without secret key.
- Remove dependency on `package:quiver`.
- The `clock` argument to `SentryClient` constructor _should_ now be
`ClockProvider` (but still accepts `Clock` for backwards compatibility).

## 2.0.2

- Add support for user context in Sentry events.

## 2.0.1

- Invert stack frames to be compatible with Sentry's default culprit detection.

## 2.0.0

- Fixed deprecation warnings for Dart 2
- Refactored tests to work with Dart 2

## 1.0.0

- first and last Dart 1-compatible release (we may fix bugs on a separate branch if there's demand)
- fix code for Dart 2

## 0.0.6

- use UTC in the `timestamp` field

## 0.0.5

- remove sub-seconds from the timestamp

## 0.0.4

- parse and report async gaps in stack traces

## 0.0.3

- environment attributes
- auto-generate event_id and timestamp for events

## 0.0.2

- parse and report stack traces
- use x-sentry-error HTTP response header
- gzip outgoing payloads by default

## 0.0.1

- basic ability to send exception reports to Sentry.io
27 changes: 27 additions & 0 deletions packages/sentry/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// Copyright 2014 The Chromium Authors. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
17 changes: 17 additions & 0 deletions packages/sentry/PATENTS
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Google hereby grants to you a perpetual, worldwide, non-exclusive,
no-charge, royalty-free, irrevocable (except as stated in this
section) patent license to make, have made, use, offer to sell, sell,
import, transfer, and otherwise run, modify and propagate the contents
of this implementation, where such license applies only to those
patent claims, both currently owned by Google and acquired in the
future, licensable by Google that are necessarily infringed by this
implementation. This grant does not include claims that would be
infringed only as a consequence of further modification of this
implementation. If you or your agent or exclusive licensee institute
or order or agree to the institution of patent litigation or any other
patent enforcement activity against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that this
implementation constitutes direct or contributory patent infringement,
or inducement of patent infringement, then any patent rights granted
to you under this License for this implementation shall terminate as
of the date such litigation is filed.
60 changes: 60 additions & 0 deletions packages/sentry/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Sentry.io client for Dart

[![Build Status](https://travis-ci.org/flutter/sentry.svg?branch=master)](https://travis-ci.org/flutter/sentry)

Use this library in your Dart programs (Flutter, command-line and (TBD) AngularDart) to report errors thrown by your
program to https://sentry.io error tracking service.

## Versions

`>=0.0.0 <2.0.0` is the range of versions compatible with Dart 1.

`>=2.0.0 <3.0.0` is the range of versions compatible with Dart 2.

## Usage

Sign up for a Sentry.io account and get a DSN at http://sentry.io.

Add `sentry` dependency to your `pubspec.yaml`:

```yaml
dependencies:
sentry: any
```

In your Dart code, import `package:sentry/sentry.dart` and create a `SentryClient` using the DSN issued by Sentry.io:

```dart
import 'package:sentry/sentry.dart';

final SentryClient sentry = new SentryClient(dsn: YOUR_DSN);
```

In an exception handler, call `captureException()`:

```dart
main() async {
try {
doSomethingThatMightThrowAnError();
} catch(error, stackTrace) {
await sentry.captureException(
exception: error,
stackTrace: stackTrace,
);
}
}
```

## Tips for catching errors

- use a `try/catch` block
- create a `Zone` with an error handler, e.g. using [runZoned][run_zoned]
- in Flutter, use [FlutterError.onError][flutter_error]
- use `Isolate.current.addErrorListener` to capture uncaught errors in the root zone

[run_zoned]: https://api.dartlang.org/stable/dart-async/runZoned.html
[flutter_error]: https://docs.flutter.io/flutter/foundation/FlutterError/onError.html

## Found a bug?

Please file it at https://github.com/flutter/flutter/issues/new
51 changes: 51 additions & 0 deletions packages/sentry/bin/test.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import 'dart:async';
import 'dart:io';

import 'package:sentry/sentry.dart';

/// Sends a test exception report to Sentry.io using this Dart client.
Future<Null> main(List<String> rawArgs) async {
if (rawArgs.length != 1) {
stderr.writeln(
'Expected exactly one argument, which is the DSN issued by Sentry.io to your project.');
exit(1);
}

final String dsn = rawArgs.single;
final SentryClient client = SentryClient(dsn: dsn);

try {
await foo();
} catch (error, stackTrace) {
print('Reporting the following stack trace: ');
print(stackTrace);
final SentryResponse response = await client.captureException(
exception: error,
stackTrace: stackTrace,
);

if (response.isSuccessful) {
print('SUCCESS\nid: ${response.eventId}');
} else {
print('FAILURE: ${response.error}');
}
} finally {
await client.close();
}
}

Future<Null> foo() async {
await bar();
}

Future<Null> bar() async {
await baz();
}

Future<Null> baz() async {
throw StateError('This is a test error');
}
Loading