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
#27492)

* display offersession promise failure instead of showing console errors

* change log() to warn() for offersession handler
  • Loading branch information
cabanier authored Jan 5, 2024
1 parent 589eeb1 commit a4fbc07
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.warn( 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.warn( 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.warn( 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.warn( 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.warn( 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.warn( err );

} );

}

Expand Down

0 comments on commit a4fbc07

Please sign in to comment.