#include "errors.h"

int stop_errors(int err, char *details)
{
    switch (err)
    {
    case ERROR_UNKNOWN_TOKEN:
        ft_putstr_fd("error: unknown token, details : ", STDERR_FILENO);
        break;
    case ERROR_NUMBER_TOO_BIG:
        ft_putstr_fd("error: number is too big, details : ", STDERR_FILENO);
        break;
    case ERROR_PARSING:
        ft_putstr_fd("error: too much terms to parse, details : ", STDERR_FILENO);
        break;
    default:
        ft_putstr_fd("unknown error, details : ", STDERR_FILENO);
        break;
    }

    ft_putstr_fd(details, STDERR_FILENO);
    ft_putchar_fd('\n', STDERR_FILENO);

    exit(err);
}