Skip to content

Commit

Permalink
capture sentry errors
Browse files Browse the repository at this point in the history
  • Loading branch information
InventivetalentDev committed Oct 18, 2024
1 parent da1f969 commit 0f80d8f
Show file tree
Hide file tree
Showing 5 changed files with 805 additions and 6 deletions.
21 changes: 21 additions & 0 deletions dist/MicrosoftAuth.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/MicrosoftAuth.js.map

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
},
"packageManager": "[email protected]",
"dependencies": {
"@sentry/node": "^8.34.0",
"@xboxreplay/xboxlive-auth": "^4.0.0",
"axios": "^1.7.2",
"qs": "^6.12.3",
Expand Down
21 changes: 21 additions & 0 deletions src/MicrosoftAuth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { RequestHandlers } from "./types/RequestHandler";
import { MSAError } from "./MSAError";
import { epochSeconds, toEpochSeconds } from "./util";
import winston from "winston";
import * as Sentry from "@sentry/node";

const MC_XSTSRelyingParty = 'rp://api.minecraftservices.com/'
const XBOX_XSTSRelyingParty = 'http://xboxlive.com'
Expand Down Expand Up @@ -70,6 +71,11 @@ export class MicrosoftAuth {
try {
userTokenResponse = await XboxLiveAuth.xbl.exchangeRpsTicketForUserToken(rpsTicket);
} catch (e) {
Sentry.captureException(e,{
tags: {
stage: 'exchangeRpsTicketForIdentities'
}
});
throw new MSAError('exchangeRpsTicketForIdentities', e);
}
// console.log("exchangeRpsTicket")
Expand Down Expand Up @@ -105,6 +111,11 @@ export class MicrosoftAuth {
data: body
});
} catch (e) {
Sentry.captureException(e,{
tags: {
stage: 'getIdentityForRelyingParty'
}
});
throw new MSAError('getIdentityForRelyingParty', e);
}
return authResponse.data as XSTSResponse
Expand All @@ -124,6 +135,11 @@ export class MicrosoftAuth {
data: qs.stringify(form)
});
} catch (e) {
Sentry.captureException(e,{
tags: {
stage: 'authenticateXboxLiveWithFormData'
}
});
throw new MSAError('authenticateXboxWithFormData', e);
}
const refreshBody = refreshResponse.data;
Expand Down Expand Up @@ -198,6 +214,11 @@ export class MicrosoftAuth {
data: body
});
} catch (e) {
Sentry.captureException(e,{
tags: {
stage: 'loginToMinecraftWithXbox'
}
});
throw new MSAError('loginToMinecraftWithXbox', e);
}
const xboxLoginBody = xboxLoginResponse.data;
Expand Down
Loading

0 comments on commit 0f80d8f

Please sign in to comment.