mirror of
https://github.com/lovell/sharp.git
synced 2025-12-19 07:15:08 +01:00
Improve consistency of validation error handling
Utilises common path of existing invalidParameterError
This commit is contained in:
@@ -63,7 +63,7 @@ function grayscale (grayscale) {
|
||||
*/
|
||||
function toColourspace (colourspace) {
|
||||
if (!is.string(colourspace)) {
|
||||
throw new Error('Invalid output colourspace ' + colourspace);
|
||||
throw is.invalidParameterError('colourspace', 'string', colourspace);
|
||||
}
|
||||
this.options.colourspace = colourspace;
|
||||
return this;
|
||||
|
||||
Reference in New Issue
Block a user