app.js
// Handles the error object and returns a JSON message
Handles the error object and returns a JSON message
Handles the error object and returns a JSON message
function handleError(error) {
    if (error.response.status === 401) {
        return {
            status: error.response.status,
            message: "Token time out please log in again",
            trackResult: null,
        };
    } else if (error.response.status === 429) {
        return {
            status: error.response.status,
            message: "Too many requests. Please try again in a few minutes.",
            trackResult: null,
        };
    } else {
        return {
            status: error.response.status,
            message:
                "Something went wrong, no idea what happened. You're on your own!",
            trackResult: null,
            error,
        };
    }
}
function handleError ( error ) { if ( error . response . status === 401 ) { return { status : error . response . status , message : "Token time out please log in again" , trackResult : null , } ; } else if ( error . response . status === 429 ) { return { status : error . response . status , message : "Too many requests. Please try again in a few minutes." , trackResult : null , } ; } else { return { status : error . response . status , message : "Something went wrong, no idea what happened. You're on your own!" , trackResult : null , error , } ; } }
Handles the error object and returns a JSON message
Handles the error object and returns a JSON message