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

* display offersession promise failure instead of showing console errors

* change log() to warn() for offersession handler
  • Loading branch information
cabanier authored and AdaRoseCannon committed Jan 15, 2024
1 parent b2f9887 commit 06fd21e
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
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
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
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 06fd21e

Please sign in to comment.