Skip to content

Commit ebb18fd

Browse files
committed
Fix compatibility with Laravel <= 6 of the sentry:test and sentry:publish commands
1 parent b42484f commit ebb18fd

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
## Unreleased
44

5+
- Fix compatibility with Laravel <= 6 of the `sentry:test` and `sentry:publish` commands
6+
57
## 2.10.0
68

79
- Improve output and DX for `sentry:test` and `sentry:publish` commands (#522)

src/Sentry/Laravel/Console/PublishCommand.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public function handle(): int
5050
if (empty($dsnFromInput)) {
5151
$this->error('Please provide a valid DSN using the `--dsn` option or setting `SENTRY_LARAVEL_DSN` in your `.env` file!');
5252

53-
return self::FAILURE;
53+
return 1;
5454
}
5555

5656
$dsn = $dsnFromInput;
@@ -75,19 +75,19 @@ public function handle(): int
7575
if ($this->confirm($testCommandPrompt, !$this->option('without-test'))) {
7676
$testResult = $this->call('sentry:test', $arg);
7777

78-
if ($testResult === self::FAILURE) {
79-
return self::FAILURE;
78+
if ($testResult === 1) {
79+
return 1;
8080
}
8181
}
8282

8383
$this->info('Publishing Sentry config...');
8484
$this->call('vendor:publish', ['--provider' => ServiceProvider::class]);
8585

8686
if (!$this->setEnvValues($env)) {
87-
return self::FAILURE;
87+
return 1;
8888
}
8989

90-
return self::SUCCESS;
90+
return 0;
9191
}
9292

9393
private function setEnvValues(array $values): bool

src/Sentry/Laravel/Console/TestCommand.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public function handle(): int
7171

7272
$this->printDebugTips();
7373

74-
return self::FAILURE;
74+
return 1;
7575
}
7676

7777
try {
@@ -82,7 +82,7 @@ public function handle(): int
8282
} catch (Exception $e) {
8383
$this->error($e->getMessage());
8484

85-
return self::FAILURE;
85+
return 1;
8686
}
8787

8888
// We set a logger so we can surface errors thrown internally by the SDK
@@ -115,7 +115,7 @@ public function log($level, $message, array $context = []): void
115115

116116
$this->printDebugTips();
117117

118-
return self::FAILURE;
118+
return 1;
119119
}
120120

121121
$this->info("Test event sent with ID: {$eventId}");
@@ -145,15 +145,15 @@ public function log($level, $message, array $context = []): void
145145

146146
$this->printDebugTips();
147147

148-
return self::FAILURE;
148+
return 1;
149149
}
150150

151151
$this->info("Transaction sent with ID: {$transactionId}");
152152
}
153153

154154
error_reporting($old_error_reporting);
155155

156-
return self::SUCCESS;
156+
return 1;
157157
}
158158

159159
/**

0 commit comments

Comments
 (0)