More descriptive errors for stryder response (#85)

This commit is contained in:
Jack 2022-09-01 16:26:50 +01:00 committed by GitHub
parent db8457a5fd
commit b45ff0ef26
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 2 deletions

View File

@ -11,6 +11,7 @@ let shouldRequireSessionToken = process.env.REQUIRE_SESSION_TOKEN = true
const { getRatelimit } = require( "../shared/ratelimit.js" )
const {
STRYDER_RESPONSE,
STRYDER_PARSE,
UNAUTHORIZED_GAME,
UNAUTHORIZED_PWD,
PLAYER_NOT_FOUND,
@ -61,7 +62,7 @@ module.exports = ( fastify, opts, done ) =>
}
catch
{
return { success: false, error: STRYDER_RESPONSE }
return { success: false, error: STRYDER_RESPONSE, response: authResponse.toString() }
}
let authJson
@ -71,7 +72,7 @@ module.exports = ( fastify, opts, done ) =>
}
catch ( error )
{
return { success: false, error: STRYDER_RESPONSE }
return { success: false, error: STRYDER_PARSE, response: authResponse.toString() }
}
// check origin auth was fine

View File

@ -21,6 +21,10 @@ const errorCodes = {
},
STRYDER_RESPONSE: {
enum: "STRYDER_RESPONSE",
msg: "Got bad response from stryder",
},
STRYDER_PARSE: {
enum: "STRYDER_PARSE",
msg: "Couldn't parse stryder response",
},
PLAYER_NOT_FOUND: {