diff --git a/examples/unlock.ts b/examples/unlock.ts index b168a286..659d9a8e 100644 --- a/examples/unlock.ts +++ b/examples/unlock.ts @@ -33,20 +33,12 @@ export const handler: Handler = async ({ deviceId, seam, logger }) => { ) logger.info({ actionAttempt }, 'unlocked') } catch (err: unknown) { - if ( - isSeamActionAttemptFailedError( - err, - ) - ) { + if (isSeamActionAttemptFailedError(err)) { logger.info({ err }, 'Could not unlock the door') return } - if ( - isSeamActionAttemptTimeoutError< - LocksUnlockDoorResponse['action_attempt'] - >(err) - ) { + if (isSeamActionAttemptTimeoutError(err)) { logger.info({ err }, 'Door took too long to unlock') return } @@ -54,3 +46,5 @@ export const handler: Handler = async ({ deviceId, seam, logger }) => { throw err } } + +type UnlockDoorActionAttempt = LocksUnlockDoorResponse['action_attempt']