Skip to content

Commit a255c84

Browse files
committed
feat: Support to parse xbox login error code
1 parent 461a5d9 commit a255c84

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

packages/user/microsoft.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,12 @@ export class MicrosoftAuthenticator {
111111
})
112112

113113
if (xstsResponse.status !== 200) {
114-
throw new Error(`Failed to authorize with xbox live, status code: ${xstsResponse.status}: ${await xstsResponse.text()}}`)
114+
const errText = await xstsResponse.text()
115+
let errObj = {} as any
116+
try {
117+
errObj = JSON.parse(errText)
118+
} catch (e) {}
119+
throw Object.assign(new Error(`Failed to authorize with xbox live, status code: ${xstsResponse.status}: ${errText}}`), errObj)
115120
}
116121

117122
const result = await xstsResponse.json() as XBoxResponse

0 commit comments

Comments
 (0)