refactor: use TypeError
instead of generic Error
when appropriate (#39209)
refactor: use TypeError instead of generic Error when appropriate
This commit is contained in:
parent
77cc1d6ffa
commit
455f57322f
9 changed files with 13 additions and 13 deletions
|
@ -477,7 +477,7 @@ WhammyVideo.prototype.add = function (frame, duration) {
|
|||
// quickly store image data so we don't block cpu. encode in compile method.
|
||||
frame = frame.getContext('2d').getImageData(0, 0, frame.width, frame.height);
|
||||
} else if (typeof frame !== 'string') {
|
||||
throw new Error('frame must be a a HTMLCanvasElement, a CanvasRenderingContext2D or a DataURI formatted string');
|
||||
throw new TypeError('frame must be a a HTMLCanvasElement, a CanvasRenderingContext2D or a DataURI formatted string');
|
||||
}
|
||||
if (typeof frame === 'string' && !(/^data:image\/webp;base64,/ig).test(frame)) {
|
||||
throw new Error('Input must be formatted properly as a base64 encoded DataURI of type image/webp');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue