Add legacy skin and cape routes, improve error handling
Introduces legacy routes for Minecraft skins and capes to support older endpoints. Enhances error handling in sessionsRepository for missing skins/capes, adds getActiveSkin and getActiveCape to sessionsService, and improves error logging in server.js.
This commit is contained in:
@@ -69,9 +69,14 @@ async function getActiveSkin(uuid) {
|
||||
`
|
||||
const rows = await database.query(sql, [uuid])
|
||||
const skin = rows[0]
|
||||
|
||||
if (!skin) {
|
||||
throw new DefaultError(404, "Not found", "Not found")
|
||||
}
|
||||
return { code: 200, data: skin || null }
|
||||
} catch (error) {
|
||||
if (error instanceof DefaultError) {
|
||||
throw error
|
||||
}
|
||||
logger.log("Internal Server Error".bold + " : " + error.toString(), ["MariaDB", "yellow"])
|
||||
throw new DefaultError(500, "Internal Server Error", "Please contact an administrator.")
|
||||
}
|
||||
@@ -87,9 +92,14 @@ async function getActiveCape(uuid) {
|
||||
`
|
||||
const rows = await database.query(sql, [uuid])
|
||||
const cape = rows[0]
|
||||
|
||||
if (!cape) {
|
||||
throw new DefaultError(404, "Not found", "Not found")
|
||||
}
|
||||
return { code: 200, data: cape || null }
|
||||
} catch (error) {
|
||||
if (error instanceof DefaultError) {
|
||||
throw error
|
||||
}
|
||||
logger.log("Internal Server Error".bold + " : " + error.toString(), ["MariaDB", "yellow"])
|
||||
throw new DefaultError(500, "Internal Server Error", "Please contact an administrator.")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user