File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed
Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -1123,13 +1123,19 @@ function decode(jpegData, userOpts = {}) {
11231123 if ( decoder . comments . length > 0 ) {
11241124 image [ "comments" ] = decoder . comments ;
11251125 }
1126- } catch ( err ) {
1127- if ( err instanceof RangeError ) {
1126+ } catch ( err ) {
1127+ if ( err instanceof RangeError ) {
11281128 throw new Error ( "Could not allocate enough memory for the image. " +
11291129 "Required: " + bytesNeeded ) ;
1130- } else {
1131- throw err ;
1130+ }
1131+
1132+ if ( err instanceof ReferenceError ) {
1133+ if ( err . message === "Buffer is not defined" ) {
1134+ throw new Error ( "Buffer is not globally defined in this environment. " +
1135+ "Consider setting useTArray to true" ) ;
1136+ }
11321137 }
1138+ throw err ;
11331139 }
11341140
11351141 decoder . copyToImageData ( image , opts . formatAsRGBA ) ;
You can’t perform that action at this time.
0 commit comments