Axios – transformResponse, parsing JSON and proper error handling

I am learning axios! What I am trying to achieve is GET with converted reply.

I am trying like this:

const getUser = async (request: Request) =>
    axios.get(`api/v1/user/1`, {
        convertUser: (data: string) => {
            return data ? convertUser(JSON.parse(data)) : data;
        }
    });
const convertUser = (data: User): ConvertedUser => {
    const convertedUser: ConvertedUser  = {
    // some convertion here
    return convertedUser;
};
interface User {
    userId: string;
    userName: string;
}

but.. when response is not User, but some kind of error – like “404”, I got an error and everything goes wrong.

where should I parse this data? how could I achieve error handling in this function? because when I am converting it – I am losing info about status error code and message.