Skip to content

Commit

Permalink
display offersession promise failure instead of showing console errors
Browse files Browse the repository at this point in the history
  • Loading branch information
cabanier committed Jan 3, 2024
1 parent 54bc177 commit 1954daf
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 6 deletions.
14 changes: 12 additions & 2 deletions examples/jsm/webxr/ARButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,12 @@ class ARButton {
if ( navigator.xr.offerSession !== undefined ) {

navigator.xr.offerSession( 'immersive-ar', sessionInit )
.then( onSessionStarted );
.then( onSessionStarted )
.catch( ( err ) => {

console.log( err );

} );

}

Expand All @@ -118,7 +123,12 @@ class ARButton {
if ( navigator.xr.offerSession !== undefined ) {

navigator.xr.offerSession( 'immersive-ar', sessionInit )
.then( onSessionStarted );
.then( onSessionStarted )
.catch( (err) => {

console.log( err );

} );

}

Expand Down
14 changes: 12 additions & 2 deletions examples/jsm/webxr/VRButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,12 @@ class VRButton {
if ( navigator.xr.offerSession !== undefined ) {

navigator.xr.offerSession( 'immersive-vr', sessionInit )
.then( onSessionStarted );
.then( onSessionStarted )
.catch( ( err ) => {

console.log( err );

} );

}

Expand All @@ -84,7 +89,12 @@ class VRButton {
if ( navigator.xr.offerSession !== undefined ) {

navigator.xr.offerSession( 'immersive-vr', sessionInit )
.then( onSessionStarted );
.then( onSessionStarted )
.catch( ( err ) => {

console.log( err );

} );

}

Expand Down
14 changes: 12 additions & 2 deletions examples/jsm/webxr/XRButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,12 @@ class XRButton {
if ( navigator.xr.offerSession !== undefined ) {

navigator.xr.offerSession( mode, sessionOptions )
.then( onSessionStarted );
.then( onSessionStarted )
.catch( ( err ) => {

console.log( err );

} );

}

Expand All @@ -88,7 +93,12 @@ class XRButton {
if ( navigator.xr.offerSession !== undefined ) {

navigator.xr.offerSession( mode, sessionOptions )
.then( onSessionStarted );
.then( onSessionStarted )
.catch( ( err ) => {

console.log( err );

} );

}

Expand Down

0 comments on commit 1954daf

Please sign in to comment.