Skip to content

Commit 8f4ccc1

Browse files
authored
Rollup merge of rust-lang#118323 - onur-ozkan:better-error-for-incorrect-profiles, r=clubby789
give dev-friendly error message for incorrect config profiles before this change, an incorrect profile would result in the following error: ```sh ... ... File "/home/nimda/devspace/onur-ozkan/rust/src/bootstrap/bootstrap.py", line 1088, in bootstrap with open(include_path) as included_toml: ^^^^^^^^^^^^^^^^^^ FileNotFoundError: [Errno 2] No such file or directory: '/home/nimda/devspace/onur-ozkan/rust/src/bootstrap/defaults/config.aaaa.toml' ``` with this change, the error message is now: ```sh ... ... File "/home/nimda/devspace/onur-ozkan/rust/src/bootstrap/bootstrap.py", line 1088, in bootstrap raise Exception("Unrecognized profile '{}'. Check src/bootstrap/defaults" Exception: Unrecognized profile 'aaaa'. Check src/bootstrap/defaults for available options. ```
2 parents 97ef5a3 + 1017042 commit 8f4ccc1

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Diff for: src/bootstrap/bootstrap.py

+5
Original file line numberDiff line numberDiff line change
@@ -1083,6 +1083,11 @@ def bootstrap(args):
10831083
include_file = 'config.{}.toml'.format(profile_aliases.get(profile) or profile)
10841084
include_dir = os.path.join(rust_root, 'src', 'bootstrap', 'defaults')
10851085
include_path = os.path.join(include_dir, include_file)
1086+
1087+
if not os.path.exists(include_path):
1088+
raise Exception("Unrecognized config profile '{}'. Check src/bootstrap/defaults"
1089+
" for available options.".format(profile))
1090+
10861091
# HACK: This works because `self.get_toml()` returns the first match it finds for a
10871092
# specific key, so appending our defaults at the end allows the user to override them
10881093
with open(include_path) as included_toml:

0 commit comments

Comments
 (0)