diff --git a/lib/src/compiler/async.ts b/lib/src/compiler/async.ts index bd559c13..0fcc64f1 100644 --- a/lib/src/compiler/async.ts +++ b/lib/src/compiler/async.ts @@ -98,7 +98,7 @@ export class AsyncCompiler { /** Guards against using a disposed compiler. */ private throwIfDisposed(): void { if (this.disposed) { - throw utils.compilerError('Async compiler has already been disposed.'); + throw utils.compilerError('Async compiler has already been disposed'); } } @@ -163,7 +163,7 @@ export class AsyncCompiler { if (flag !== initFlag) { throw utils.compilerError( 'AsyncCompiler can not be directly constructed. ' + - 'Please use `sass.initAsyncCompiler()` instead.', + 'Please use `sass.initAsyncCompiler()` instead', ); } this.stderr$.subscribe(data => process.stderr.write(data)); diff --git a/lib/src/compiler/sync.ts b/lib/src/compiler/sync.ts index 7aeef3ab..a2e11d4a 100644 --- a/lib/src/compiler/sync.ts +++ b/lib/src/compiler/sync.ts @@ -154,7 +154,7 @@ export class Compiler { for (;;) { if (!this.yield()) { - throw utils.compilerError('Embedded compiler exited unexpectedly.'); + throw utils.compilerError('Embedded compiler exited unexpectedly'); } if (error) throw error; @@ -168,7 +168,7 @@ export class Compiler { /** Guards against using a disposed compiler. */ private throwIfDisposed(): void { if (this.disposed) { - throw utils.compilerError('Sync compiler has already been disposed.'); + throw utils.compilerError('Sync compiler has already been disposed'); } } @@ -177,7 +177,7 @@ export class Compiler { if (flag !== initFlag) { throw utils.compilerError( 'Compiler can not be directly constructed. ' + - 'Please use `sass.initAsyncCompiler()` instead.', + 'Please use `sass.initCompiler()` instead', ); } this.stderr$.subscribe(data => process.stderr.write(data)); diff --git a/lib/src/compiler/utils.ts b/lib/src/compiler/utils.ts index 098753d3..92ce8e42 100644 --- a/lib/src/compiler/utils.ts +++ b/lib/src/compiler/utils.ts @@ -225,7 +225,7 @@ export function handleCompileResponse( } else if (response.result.case === 'failure') { throw new Exception(response.result.value); } else { - throw utils.compilerError('Compiler sent empty CompileResponse.'); + throw utils.compilerError('Compiler sent empty CompileResponse'); } } diff --git a/lib/src/deprotofy-span.ts b/lib/src/deprotofy-span.ts index bd32762f..8e2b8867 100644 --- a/lib/src/deprotofy-span.ts +++ b/lib/src/deprotofy-span.ts @@ -14,20 +14,20 @@ export function deprotofySourceSpan(buffer: proto.SourceSpan): SourceSpan { const text = buffer.text; if (buffer.start === undefined) { - throw compilerError('Expected SourceSpan to have start.'); + throw compilerError('Expected SourceSpan to have start'); } let end; if (buffer.end === undefined) { if (text !== '') { - throw compilerError('Expected SourceSpan text to be empty.'); + throw compilerError('Expected SourceSpan text to be empty'); } else { end = buffer.start; } } else { end = buffer.end; if (end.offset < buffer.start.offset) { - throw compilerError('Expected SourceSpan end to be after start.'); + throw compilerError('Expected SourceSpan end to be after start'); } } diff --git a/lib/src/protofier.ts b/lib/src/protofier.ts index c06dfdd6..f772901f 100644 --- a/lib/src/protofier.ts +++ b/lib/src/protofier.ts @@ -324,7 +324,7 @@ export class Protofier { }); default: - throw utils.compilerError(`Unknown color space "${color.space}".`); + throw utils.compilerError(`Unknown color space "${color.space}"`); } } @@ -394,7 +394,7 @@ export class Protofier { case 'hostFunction': throw utils.compilerError( - 'The compiler may not send Value.host_function.', + 'The compiler may not send Value.host_function', ); case 'compilerMixin': @@ -454,7 +454,7 @@ export class Protofier { case 'calc': if (calculation.arguments.length !== 1) { throw utils.compilerError( - 'Value.Calculation.arguments must have exactly one argument for calc().', + 'Value.Calculation.arguments must have exactly one argument for calc()', ); } return SassCalculation.calc( @@ -466,7 +466,7 @@ export class Protofier { calculation.arguments.length > 3 ) { throw utils.compilerError( - 'Value.Calculation.arguments must have 1 to 3 arguments for clamp().', + 'Value.Calculation.arguments must have 1 to 3 arguments for clamp()', ); } return SassCalculation.clamp( @@ -481,7 +481,7 @@ export class Protofier { case 'min': if (calculation.arguments.length === 0) { throw utils.compilerError( - 'Value.Calculation.arguments must have at least 1 argument for min().', + 'Value.Calculation.arguments must have at least 1 argument for min()', ); } return SassCalculation.min( @@ -490,7 +490,7 @@ export class Protofier { case 'max': if (calculation.arguments.length === 0) { throw utils.compilerError( - 'Value.Calculation.arguments must have at least 1 argument for max().', + 'Value.Calculation.arguments must have at least 1 argument for max()', ); } return SassCalculation.max( @@ -498,7 +498,7 @@ export class Protofier { ); default: throw utils.compilerError( - `Value.Calculation.name "${calculation.name}" is not a recognized calculation type.`, + `Value.Calculation.name "${calculation.name}" is not a recognized calculation type`, ); } } diff --git a/lib/src/utils.ts b/lib/src/utils.ts index 1dbbd75c..308f56a8 100644 --- a/lib/src/utils.ts +++ b/lib/src/utils.ts @@ -73,7 +73,7 @@ export function compilerError(message: string): Error { * been included but was not. */ export function mandatoryError(field: string): Error { - return compilerError(`Missing mandatory field ${field}`); + return compilerError(`Missing mandatory field ${field}.`); } /** Constructs a host-caused Error. */ diff --git a/lib/src/value/color.ts b/lib/src/value/color.ts index 60b2928a..c9dc79fa 100644 --- a/lib/src/value/color.ts +++ b/lib/src/value/color.ts @@ -249,7 +249,7 @@ function validateChannelInSpace( } if (!valid) { throw valueError( - `Unknown channel name "${channel}" for color space "${space}".`, + `Unknown channel name "${channel}" for color space "${space}"`, ); } } @@ -893,7 +893,7 @@ export class SassColor extends Value { if (weight < 0 || weight > 1) { throw valueError( - `Expected \`weight\` between \`0\` and \`1\`, received \`${weight}\`.`, + `Expected \`weight\` between \`0\` and \`1\`, received \`${weight}\``, ); } diff --git a/lib/src/value/index.ts b/lib/src/value/index.ts index b77c3395..793d04db 100644 --- a/lib/src/value/index.ts +++ b/lib/src/value/index.ts @@ -86,7 +86,7 @@ export abstract class Value implements ValueObject { } if (Math.abs(index) > this.lengthAsList) { throw valueError( - `Invalid index ${sassIndex} for a list with ${this.lengthAsList} elements.`, + `Invalid index ${sassIndex} for a list with ${this.lengthAsList} elements`, name, ); } diff --git a/lib/src/value/number.ts b/lib/src/value/number.ts index 52397e57..298c99ac 100644 --- a/lib/src/value/number.ts +++ b/lib/src/value/number.ts @@ -596,7 +596,7 @@ export class SassNumber extends Value { } if (!otherHasUnits) { - return valueError(`Expected ${this} to have no units.`, params.name); + return valueError(`Expected ${this} to have no units`, params.name); } // For single numerators, throw a detailed error with info about which unit @@ -607,7 +607,7 @@ export class SassNumber extends Value { return valueError( `Expected ${this} to have a single ${type} unit (${unitsByType[ type - ].join(', ')}).`, + ].join(', ')})`, params.name, ); } @@ -622,7 +622,7 @@ export class SassNumber extends Value { newNumerators, newDenominators, )}` - }.`, + }`, params.name, ); };