File tree 1 file changed +7
-4
lines changed
modules/engine/src/async-texture
1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -102,11 +102,13 @@ export class AsyncTexture {
102
102
}
103
103
104
104
async initAsync ( props : AsyncTextureProps ) : Promise < void > {
105
- let resolveReady ;
106
- let rejectReady ;
107
-
108
105
const asyncData : AsyncTextureData = props . data ;
109
- const data : TextureData = await awaitAllPromises ( asyncData ) . then ( resolveReady , rejectReady ) ;
106
+ let data : TextureData ;
107
+ try {
108
+ data = await awaitAllPromises ( asyncData ) ;
109
+ } catch ( error ) {
110
+ this . rejectReady ( error as Error ) ;
111
+ }
110
112
111
113
// Check that we haven't been destroyed while waiting for texture data to load
112
114
if ( this . destroyed ) {
@@ -121,6 +123,7 @@ export class AsyncTexture {
121
123
this . sampler = this . texture . sampler ;
122
124
this . view = this . texture . view ;
123
125
this . isReady = true ;
126
+ this . resolveReady ( ) ;
124
127
}
125
128
126
129
destroy ( ) : void {
You can’t perform that action at this time.
0 commit comments