Skip to content

Commit 0b07d23

Browse files
committed
Reword error messages
1 parent 38429c9 commit 0b07d23

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

flit_core/flit_core/config.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -845,7 +845,7 @@ def normalise_compound_license_expr(s: str) -> str:
845845
raise ConfigError(f"The SPDX 'WITH' operator is not yet supported!")
846846
elif part in {'AND', 'OR'}:
847847
if not parts or parts[-1] in {' AND ', ' OR ', ' WITH ', '('}:
848-
reason = f"'{part}' must follow a license ID"
848+
reason = f"a license ID is missing before '{part}'"
849849
raise ConfigError(invalid_msg.format(s=s, reason=reason))
850850
parts.append(f' {part} ')
851851
elif part.lower() in {'and', 'or', 'with'}:
@@ -860,7 +860,7 @@ def normalise_compound_license_expr(s: str) -> str:
860860
parts.append(part)
861861
elif part == ')':
862862
if not parts or parts[-1] in {' AND ', ' OR ', ' WITH ', '('}:
863-
reason = "')' must follow a license ID"
863+
reason = f"a license ID is missing before '{part}'"
864864
raise ConfigError(invalid_msg.format(s=s, reason=reason))
865865
stack -= 1
866866
if stack < 0:
@@ -878,7 +878,8 @@ def normalise_compound_license_expr(s: str) -> str:
878878
reason = 'unbalanced brackets'
879879
raise ConfigError(invalid_msg.format(s=s, reason=reason))
880880
if parts[-1] in {' AND ', ' OR ', ' WITH '}:
881-
reason = f"'{parts[-1].strip()}' is missing a second operand"
881+
last_part = parts[-1].strip()
882+
reason = f"a license ID or expression should follow '{last_part}'"
882883
raise ConfigError(invalid_msg.format(s=s, reason=reason))
883884
except ConfigError:
884885
if os.environ.get('FLIT_ALLOW_INVALID'):

0 commit comments

Comments
 (0)