Skip to content

Revise Getting Started section #1513

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 4 commits into from
Mar 2, 2020
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
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
Import and initialize the Sentry SDK early in your application's setup:

```go
import "github.com/getsentry/sentry-go"
package main

import (
"log"

"github.com/getsentry/sentry-go"
)

func main() {
sentry.Init(sentry.ClientOptions{
err := sentry.Init(sentry.ClientOptions{
Comment on lines -7 to +13
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Adds error handling here. It is easy enough to ignore the error and end up with a misconfigured SDK without warning.

Although this makes the documentation more verbose, this is also where people will refer to. Better have the full picture when copy-pasting.

Dsn: "___PUBLIC_DSN___",
})
if err != nil {
log.Fatalf("sentry.Init: %s", err)
}
}
```
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
One way to break your JavaScript application is to call an undefined function:
One way to verify your setup is by intentionally sending an event that breaks your application.

Calling an undefined function will throw an exception:

```js
myUndefinedFunction();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
One way to break your Cordova application is to call an undefined function:
One way to verify your setup is by intentionally sending an event that breaks your application.

Calling an undefined function will throw an exception:

```js
myUndefinedFunction();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
One way to break your Electron application is to call an undefined function:
One way to verify your setup is by intentionally sending an event that breaks your application.

Calling an undefined function will throw an exception:

```js
myUndefinedFunction();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,25 @@
The quickest way to verify Sentry in your Go application is to capture an error:
The quickest way to verify Sentry in your Go program is to capture a message:

```go
package main

import (
"errors"
"log"
"time"

"github.com/getsentry/sentry-go"
)

func main() {
sentry.Init(sentry.ClientOptions{
err := sentry.Init(sentry.ClientOptions{
Dsn: "___PUBLIC_DSN___",
})
if err != nil {
log.Fatalf("sentry.Init: %s", err)
}
// Flush buffered events before the program terminates.
defer sentry.Flush(2 * time.Second)

sentry.CaptureException(errors.New("my error"))
// Since sentry emits events in the background we need to make sure
// they are sent before we shut down
sentry.Flush(time.Second * 5)
sentry.CaptureMessage("It works!")
Comment on lines +21 to +23
Copy link
Contributor Author

Choose a reason for hiding this comment

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

For testing purposes, a message is simpler to setup than an error.

Prefer educating users to use defer sentry.Flush(...) instead of calling Flush after CaptureException.
People got the wrong impression that they need to call the two functions in sequence all the time.

}
```
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
One way to break your JavaScript application is to call an undefined function:
One way to verify your setup is by intentionally sending an event that breaks your application.

Calling an undefined function will throw an exception:

```js
myUndefinedFunction();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
You can trigger a PHP exception by throwing one in your application:
One way to verify your setup is by intentionally sending an event that breaks your application.

You can throw an exception in your PHP application:

```php
throw new Exception("My first Sentry error!");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
You can cause a Python error by inserting a divide by zero expression
One way to verify your setup is by intentionally sending an event that breaks your application.

Raise an unhandled Python exception by inserting a divide by zero expression
into your application:

```py
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
One way to verify your setup is by intentionally sending an event that breaks your application.

The quickest way to verify Sentry in your Rust application is to cause a panic:

```rust
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ After you completed setting up a project in Sentry, you’ll be given a value wh

## Capturing your first event

Once you have Sentry integrated into your project, you probably want to verify that everything is working as expected before deploying it, and what better way to do that than to break your application!
Once you have Sentry integrated into your project, you probably want to verify that everything is working as expected before deploying it.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not all platforms suggest "breaking your application", therefore move this sentence to where it is appropriate, and leave it out elsewhere.


{% wizard %}
{% include components/platform_content.html content_dir='getting-started-verify' %}
Expand Down