File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change 11/* eslint-disable no-console, antfu/no-top-level-await */
22import KeyvFile from "keyv-file" ;
33import prompts from "prompts" ;
4- import { VRChat } from "vrchat" ;
4+ import { VRChat , VRChatError } from "vrchat" ;
55
66const vrchat = new VRChat ( {
77 /**
@@ -32,7 +32,11 @@ const { data: user } = await vrchat
3232 . getCurrentUser ( { throwOnError : true } )
3333 // Since we've passed `throwOnError: true`, this will throw an error if the user is not logged in.
3434 // We can catch that error and prompt the user for their credentials.
35- . catch ( async ( ) => {
35+ . catch ( async ( reason ) => {
36+ // Rethrow the error if it's not a 401 Unauthorized error.
37+ if ( ! ( reason instanceof VRChatError ) || reason . statusCode !== 401 )
38+ throw reason ;
39+
3640 /**
3741 * Ask the user for their VRChat username and password.
3842 * You can also use environment variables, or any other method to get the credentials.
You can’t perform that action at this time.
0 commit comments