Skip to content

Commit 88ab595

Browse files
author
Roger
committed
reliability
1 parent b188461 commit 88ab595

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

src/index.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,10 @@ class ExampleMentraOSApp extends AppServer {
6565
// the user pressed the button, so we take a single photo
6666
try {
6767
// first, get the photo
68-
const photoRequest = session.camera.requestPhoto();
68+
const photo = await session.camera.requestPhoto();
6969
// if there was an error, log it
70-
photoRequest.catch((error) => this.logger.error(`Error taking photo: ${error}`));
71-
// if there was no error, cache the photo for display
72-
photoRequest.then((photo) => {
73-
this.logger.info(`Photo taken for user ${userId}, timestamp: ${photo.timestamp}`);
74-
this.cachePhoto(photo, userId);
75-
});
70+
this.logger.info(`Photo taken for user ${userId}, timestamp: ${photo.timestamp}`);
71+
this.cachePhoto(photo, userId);
7672
} catch (error) {
7773
this.logger.error(`Error taking photo: ${error}`);
7874
}

0 commit comments

Comments
 (0)