Skip to content

Commit 0a17c92

Browse files
committed
xLink - Handle HttpError explicitly in Minecraft service to prevent unnecessary error wrapping
1 parent 7022fc4 commit 0a17c92

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/services/minecraft.service.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import {randomUUID} from "crypto";
22
import jwtLib from "jsonwebtoken";
33

44
import {env} from "../config/env.js";
5-
import {badRequest, forbidden, internal, unauthorized} from "../utils/httpError.js";
5+
import {HttpError, badRequest, forbidden, internal, unauthorized} from "../utils/httpError.js";
66
import {createHttp} from "../utils/http.js";
77

88
const AUTH_BASE = "https://authorization.franchise.minecraft-services.net/api/v1.0/session/start";
@@ -54,6 +54,7 @@ export async function getMCToken(sessionTicket) {
5454
htmlSnippet: isString ? res.data.slice(0, 800) : undefined
5555
});
5656
} catch (err) {
57+
if (err instanceof HttpError) throw err;
5758
const status = err.response?.status;
5859
const detail = err.details || err.response?.data || err.message || err;
5960
if (status === 401) {
@@ -376,6 +377,7 @@ export async function sendMarketplaceMessageEvents(mcToken, options = {}) {
376377
sessionHeaderId
377378
};
378379
} catch (err) {
380+
if (err instanceof HttpError) throw err;
379381
const status = err.response?.status;
380382
const detail = err.response?.data || err.message || err;
381383
if (status === 401) {

0 commit comments

Comments
 (0)