|
@@ -5,6 +5,11 @@ import type {
|
|
|
DocsParams,
|
|
|
OnboardingConfig,
|
|
|
} from 'sentry/components/onboarding/gettingStartedDoc/types';
|
|
|
+import {
|
|
|
+ getCrashReportModalConfigDescription,
|
|
|
+ getCrashReportModalIntroduction,
|
|
|
+ getCrashReportSDKInstallFirstStep,
|
|
|
+} from 'sentry/components/onboarding/gettingStartedDoc/utils/feedbackOnboarding';
|
|
|
import replayOnboardingJsLoader from 'sentry/gettingStartedDocs/javascript/jsLoader/jsLoader';
|
|
|
import {t, tct} from 'sentry/locale';
|
|
|
|
|
@@ -242,10 +247,101 @@ const customMetricsOnboarding: OnboardingConfig = {
|
|
|
],
|
|
|
};
|
|
|
|
|
|
+const crashReportOnboarding: OnboardingConfig = {
|
|
|
+ introduction: () => getCrashReportModalIntroduction(),
|
|
|
+ install: (params: Params) => [
|
|
|
+ {
|
|
|
+ type: StepType.INSTALL,
|
|
|
+ configurations: [
|
|
|
+ getCrashReportSDKInstallFirstStep(params),
|
|
|
+ {
|
|
|
+ description: tct(
|
|
|
+ 'Next, create [code:resources/views/errors/500.blade.php], and embed the feedback code:',
|
|
|
+ {code: <code />}
|
|
|
+ ),
|
|
|
+ code: [
|
|
|
+ {
|
|
|
+ label: 'HTML',
|
|
|
+ value: 'html',
|
|
|
+ language: 'html',
|
|
|
+ code: `<div class="content">
|
|
|
+ <div class="title">Something went wrong.</div>
|
|
|
+
|
|
|
+ @if(app()->bound('sentry') && app('sentry')->getLastEventId())
|
|
|
+ <div class="subtitle">Error ID: {{ app('sentry')->getLastEventId() }}</div>
|
|
|
+ <script>
|
|
|
+ Sentry.init({ dsn: '${params.dsn}' });
|
|
|
+ Sentry.showReportDialog({
|
|
|
+ eventId: '{{ app('sentry')->getLastEventId() }}'
|
|
|
+ });
|
|
|
+ </script>
|
|
|
+ @endif
|
|
|
+</div>`,
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ {
|
|
|
+ description: tct(
|
|
|
+ 'For Laravel 5 up to 5.4 there is some extra work needed. You need to open up [codeApp:App/Exceptions/Handler.php] and extend the [codeRender:render] method to make sure the 500 error is rendered as a view correctly, in 5.5+ this step is not required anymore.',
|
|
|
+ {code: <code />}
|
|
|
+ ),
|
|
|
+ code: [
|
|
|
+ {
|
|
|
+ label: 'PHP',
|
|
|
+ value: 'php',
|
|
|
+ language: 'php',
|
|
|
+ code: `<?php
|
|
|
+
|
|
|
+use Symfony\Component\HttpKernel\Exception\HttpException;
|
|
|
+
|
|
|
+class Handler extends ExceptionHandler
|
|
|
+{
|
|
|
+ public function report(Exception $exception)
|
|
|
+ {
|
|
|
+ if (app()->bound('sentry') && $this->shouldReport($exception)) {
|
|
|
+ app('sentry')->captureException($exception);
|
|
|
+ }
|
|
|
+
|
|
|
+ parent::report($exception);
|
|
|
+ }
|
|
|
+
|
|
|
+ // This method is ONLY needed for Laravel 5 up to 5.4.
|
|
|
+ // You can skip this method if you are using Laravel 5.5+.
|
|
|
+ public function render($request, Exception $exception)
|
|
|
+ {
|
|
|
+ // Convert all non-http exceptions to a proper 500 http exception
|
|
|
+ // if we don't do this exceptions are shown as a default template
|
|
|
+ // instead of our own view in resources/views/errors/500.blade.php
|
|
|
+ if ($this->shouldReport($exception) && !$this->isHttpException($exception) && !config('app.debug')) {
|
|
|
+ $exception = new HttpException(500, 'Whoops!');
|
|
|
+ }
|
|
|
+
|
|
|
+ return parent::render($request, $exception);
|
|
|
+ }
|
|
|
+}`,
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ configure: () => [
|
|
|
+ {
|
|
|
+ type: StepType.CONFIGURE,
|
|
|
+ description: getCrashReportModalConfigDescription({
|
|
|
+ link: 'https://docs.sentry.io/platforms/php/guides/laravel/user-feedback/configuration/#crash-report-modal',
|
|
|
+ }),
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ verify: () => [],
|
|
|
+ nextSteps: () => [],
|
|
|
+};
|
|
|
+
|
|
|
const docs: Docs = {
|
|
|
onboarding,
|
|
|
replayOnboardingJsLoader,
|
|
|
customMetricsOnboarding,
|
|
|
+ crashReportOnboarding,
|
|
|
};
|
|
|
|
|
|
export default docs;
|