Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/src/compiler/async.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
}

Expand Down Expand Up @@ -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));
Expand Down
6 changes: 3 additions & 3 deletions lib/src/compiler/sync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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');
}
}

Expand All @@ -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));
Expand Down
2 changes: 1 addition & 1 deletion lib/src/compiler/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
}

Expand Down
6 changes: 3 additions & 3 deletions lib/src/deprotofy-span.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
}

Expand Down
14 changes: 7 additions & 7 deletions lib/src/protofier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ export class Protofier {
});

default:
throw utils.compilerError(`Unknown color space "${color.space}".`);
throw utils.compilerError(`Unknown color space "${color.space}"`);
}
}

Expand Down Expand Up @@ -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':
Expand Down Expand Up @@ -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(
Expand All @@ -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(
Expand All @@ -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(
Expand All @@ -490,15 +490,15 @@ 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(
calculation.arguments.map(this.deprotofyCalculationValue),
);
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`,
);
}
}
Expand Down
2 changes: 1 addition & 1 deletion lib/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand Down
4 changes: 2 additions & 2 deletions lib/src/value/color.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}"`,
);
}
}
Expand Down Expand Up @@ -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}\``,
);
}

Expand Down
2 changes: 1 addition & 1 deletion lib/src/value/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
);
}
Expand Down
6 changes: 3 additions & 3 deletions lib/src/value/number.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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,
);
}
Expand All @@ -622,7 +622,7 @@ export class SassNumber extends Value {
newNumerators,
newDenominators,
)}`
}.`,
}`,
params.name,
);
};
Expand Down
Loading