1
0
Fork 0

Improve errors for invalid `build_profile` SCons options

- Use a colored print when the file isn't found.
- Mention that the file is invalid JSON in the decoding error,
  and mention the location of the error.
This commit is contained in:
Hugo Locurcio 2026-01-22 01:55:11 +01:00
parent 76addfff12
commit e13bf94a5f
1 changed files with 5 additions and 2 deletions

View File

@ -648,8 +648,11 @@ if env["build_profile"] != "":
dbo = ft["disabled_build_options"]
for c in dbo:
env[c] = dbo[c]
except json.JSONDecodeError:
print_error(f'Failed to open feature build profile: "{env["build_profile"]}"')
except json.JSONDecodeError as err:
print_error(f'Failed to open feature build profile due to JSON decoding error: "{env["build_profile"]}"\n{err}')
Exit(255)
except FileNotFoundError:
print_error(f'Feature build profile not found at: "{env["build_profile"]}"')
Exit(255)
# 'dev_mode' and 'production' are aliases to set default options if they haven't been