Commit 45ea1f0
Prevent UrlRewriterParseException from being wrapped in RuntimeException (bazelbuild#28305)
When attempting to run a Bazel command, Bazel server will shutdown and exit with an unexpected error when the [downloader config](https://bazel.build/reference/command-line-reference#common_options-flag--downloader_config) is invalid:
```
$ echo "#test\nfoo" > bazel_downloader.cfg
$ cat bazel_downloader.cfg
#test
foo
$ bazel-dev build //... --downloader_config=bazel_downloader.cfg
< exits immediately with the Bazel server killed >
$ echo $?
37
```
`37` corresponds to `Unhandled Exception / Internal Bazel Error` as per the [docs](https://bazel.build/run/scripts#exit-codes).
This PR introduces changes that will let catch and rethrow `UrlRewriterParseException` before `Closer.rethrow()` to prevent it from being wrapped in `RuntimeException`.
```
$ bazel-dev-fixed query //... --downloader_config=bazel_downloader.cfg
...
ERROR: Failed to parse downloader config at bazel_downloader.cfg:2: Unable to parse: foo
$ echo $?
2
```
Closes bazelbuild#28305.
PiperOrigin-RevId: 891501161
Change-Id: I3cbfe2e2cdcad14c6b5e8210e2e1b8e999eba0ae1 parent 1527433 commit 45ea1f0
2 files changed
Lines changed: 5 additions & 1 deletion
File tree
- src
- main/java/com/google/devtools/build/lib/bazel/repository/downloader
- test/java/com/google/devtools/build/lib/bazel/repository/downloader
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
125 | 125 | | |
126 | 126 | | |
127 | 127 | | |
128 | | - | |
| 128 | + | |
129 | 129 | | |
130 | 130 | | |
131 | 131 | | |
| |||
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
261 | 261 | | |
262 | 262 | | |
263 | 263 | | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
264 | 267 | | |
265 | 268 | | |
266 | 269 | | |
267 | 270 | | |
268 | 271 | | |
| 272 | + | |
269 | 273 | | |
270 | 274 | | |
271 | 275 | | |
| |||
0 commit comments