mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-11 05:57:07 +03:00
Use error log level, prefix messages
This commit is contained in:
@@ -67,7 +67,7 @@ function compileConfig(config: string): AdvancedSkipRule[] | null {
|
|||||||
const { rules, errors } = parseConfig(config);
|
const { rules, errors } = parseConfig(config);
|
||||||
|
|
||||||
for (const error of errors) {
|
for (const error of errors) {
|
||||||
console.log(`Error on line ${error.span.start.line}: ${error.message}`);
|
console.error(`[SB] Error on line ${error.span.start.line}: ${error.message}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (errors.length === 0) {
|
if (errors.length === 0) {
|
||||||
|
|||||||
@@ -737,11 +737,9 @@ export function parseConfig(config: string): { rules: AdvancedSkipRule[]; errors
|
|||||||
}
|
}
|
||||||
|
|
||||||
expect(["if"], rule.comments.length !== 0 ? "expected `if` after `comment`" : "expected `if`", true);
|
expect(["if"], rule.comments.length !== 0 ? "expected `if` after `comment`" : "expected `if`", true);
|
||||||
|
|
||||||
rule.predicate = parsePredicate();
|
rule.predicate = parsePredicate();
|
||||||
|
|
||||||
expect(["disabled", "show overlay", "manual skip", "auto skip"], "expected skip option after predicate", true);
|
expect(["disabled", "show overlay", "manual skip", "auto skip"], "expected skip option after condition", true);
|
||||||
|
|
||||||
switch (previous.type) {
|
switch (previous.type) {
|
||||||
case "disabled":
|
case "disabled":
|
||||||
rule.skipOption = CategorySkipOption.Disabled;
|
rule.skipOption = CategorySkipOption.Disabled;
|
||||||
@@ -801,7 +799,7 @@ export function parseConfig(config: string): { rules: AdvancedSkipRule[]; errors
|
|||||||
function parsePrimary(): AdvancedSkipPredicate {
|
function parsePrimary(): AdvancedSkipPredicate {
|
||||||
if (match(["("])) {
|
if (match(["("])) {
|
||||||
const predicate = parsePredicate();
|
const predicate = parsePredicate();
|
||||||
expect([")"], "expected `)` after predicate", true);
|
expect([")"], "expected `)` after condition", true);
|
||||||
return predicate;
|
return predicate;
|
||||||
} else {
|
} else {
|
||||||
return parseCheck();
|
return parseCheck();
|
||||||
|
|||||||
Reference in New Issue
Block a user