@@ -25,7 +25,7 @@ class TGALoader extends DataTextureLoader {
25
25
case TGA_TYPE_RLE_INDEXED :
26
26
if ( header . colormap_length > 256 || header . colormap_size !== 24 || header . colormap_type !== 1 ) {
27
27
28
- console . error ( 'THREE.TGALoader: Invalid type colormap data for indexed type.' ) ;
28
+ throw new Error ( 'THREE.TGALoader: Invalid type colormap data for indexed type.' ) ;
29
29
30
30
}
31
31
@@ -39,7 +39,7 @@ class TGALoader extends DataTextureLoader {
39
39
case TGA_TYPE_RLE_GREY :
40
40
if ( header . colormap_type ) {
41
41
42
- console . error ( 'THREE.TGALoader: Invalid type colormap data for colormap type.' ) ;
42
+ throw new Error ( 'THREE.TGALoader: Invalid type colormap data for colormap type.' ) ;
43
43
44
44
}
45
45
@@ -48,20 +48,20 @@ class TGALoader extends DataTextureLoader {
48
48
// What the need of a file without data ?
49
49
50
50
case TGA_TYPE_NO_DATA :
51
- console . error ( 'THREE.TGALoader: No data.' ) ;
51
+ throw new Error ( 'THREE.TGALoader: No data.' ) ;
52
52
53
53
// Invalid type ?
54
54
55
55
default :
56
- console . error ( 'THREE.TGALoader: Invalid type "%s".' , header . image_type ) ;
56
+ throw new Error ( 'THREE.TGALoader: Invalid type ' + header . image_type ) ;
57
57
58
58
}
59
59
60
60
// check image width and height
61
61
62
62
if ( header . width <= 0 || header . height <= 0 ) {
63
63
64
- console . error ( 'THREE.TGALoader: Invalid image size.' ) ;
64
+ throw new Error ( 'THREE.TGALoader: Invalid image size.' ) ;
65
65
66
66
}
67
67
@@ -70,7 +70,7 @@ class TGALoader extends DataTextureLoader {
70
70
if ( header . pixel_size !== 8 && header . pixel_size !== 16 &&
71
71
header . pixel_size !== 24 && header . pixel_size !== 32 ) {
72
72
73
- console . error ( 'THREE.TGALoader: Invalid pixel size "%s".' , header . pixel_size ) ;
73
+ throw new Error ( 'THREE.TGALoader: Invalid pixel size ' + header . pixel_size ) ;
74
74
75
75
}
76
76
@@ -365,7 +365,7 @@ class TGALoader extends DataTextureLoader {
365
365
break ;
366
366
367
367
default :
368
- console . error ( 'THREE.TGALoader: Format not supported.' ) ;
368
+ throw new Error ( 'THREE.TGALoader: Format not supported.' ) ;
369
369
break ;
370
370
371
371
}
@@ -391,7 +391,7 @@ class TGALoader extends DataTextureLoader {
391
391
break ;
392
392
393
393
default :
394
- console . error ( 'THREE.TGALoader: Format not supported.' ) ;
394
+ throw new Error ( 'THREE.TGALoader: Format not supported.' ) ;
395
395
break ;
396
396
397
397
}
@@ -422,7 +422,7 @@ class TGALoader extends DataTextureLoader {
422
422
TGA_ORIGIN_UL = 0x02 ,
423
423
TGA_ORIGIN_UR = 0x03 ;
424
424
425
- if ( buffer . length < 19 ) console . error ( 'THREE.TGALoader: Not enough data to contain header.' ) ;
425
+ if ( buffer . length < 19 ) throw new Error ( 'THREE.TGALoader: Not enough data to contain header.' ) ;
426
426
427
427
let offset = 0 ;
428
428
@@ -450,7 +450,7 @@ class TGALoader extends DataTextureLoader {
450
450
451
451
if ( header . id_length + offset > buffer . length ) {
452
452
453
- console . error ( 'THREE.TGALoader: No data.' ) ;
453
+ throw new Error ( 'THREE.TGALoader: No data.' ) ;
454
454
455
455
}
456
456
0 commit comments