-
Notifications
You must be signed in to change notification settings - Fork 220
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d688e72
commit 985a54c
Showing
7 changed files
with
60 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,9 @@ import ( | |
"os" | ||
"os/signal" | ||
"strings" | ||
"time" | ||
|
||
"github.com/getsentry/sentry-go" | ||
"github.com/mitchellh/mapstructure" | ||
"github.com/spf13/afero" | ||
"github.com/spf13/cobra" | ||
|
@@ -65,6 +67,16 @@ func IsExperimental(cmd *cobra.Command) bool { | |
} | ||
|
||
var ( | ||
sentryOpts = sentry.ClientOptions{ | ||
Dsn: utils.SentryDsn, | ||
Release: utils.Version, | ||
ServerName: "<redacted>", | ||
// Set TracesSampleRate to 1.0 to capture 100% | ||
// of transactions for performance monitoring. | ||
// We recommend adjusting this value in production, | ||
TracesSampleRate: 1.0, | ||
} | ||
|
||
rootCmd = &cobra.Command{ | ||
Use: "supabase", | ||
Short: "Supabase CLI " + utils.Version, | ||
|
@@ -103,7 +115,9 @@ var ( | |
utils.CmdSuggestion = utils.SuggestDebugFlag | ||
} | ||
cmd.SetContext(ctx) | ||
return nil | ||
// Setup sentry last to ignore errors from parsing cli flags | ||
// sentryOpts.Dsn = "https://[email protected]/4506382322302976" | ||
return sentry.Init(sentryOpts) | ||
}, | ||
SilenceErrors: true, | ||
} | ||
|
@@ -115,6 +129,11 @@ func Execute() { | |
if len(utils.CmdSuggestion) > 0 { | ||
fmt.Fprintln(os.Stderr, utils.CmdSuggestion) | ||
} | ||
if event := sentry.CaptureException(err); event != nil { | ||
if len(utils.SentryDsn) > 0 && sentry.Flush(2*time.Second) { | ||
fmt.Fprintln(os.Stderr, "Sent crash report:", *event) | ||
} | ||
} | ||
os.Exit(1) | ||
} | ||
if utils.CmdSuggestion != utils.SuggestDebugFlag { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters