I would like to do some error handling in C. I like C# exceptions so decided to do something like that. The goals are:
- One line error handling in caller functions like throw exception in C#
 - Breaks the code sequence in caller function where the error happened
 - To know the file/line where the error happened
 - Verbal description about the error
 
What do you think is there any problem with this approach?
The caller function:
EError activate_add(uint32_t key)
{
    if (activate_bufferSize+1>=activate_bufferMax) THROW_ERROR("activate list full");
    activate_buffer[activate_bufferSize].Id = activate_bufferSize+1;
    activate_buffer[activate_bufferSize].StoredKey = key;
    activate_bufferSize++;
    TRY(activate_saveToEEProm());
    NO_ERROR();
}
My solution is the following:
#ifndef ERROR_H_
#define ERROR_H_
typedef enum
{
    Message_None,
    Message_Error,
    Message_Warning,
    Message_Info
}EMessage_type;
typedef struct
{
    EMessage_type message_type;
    char* message;
    const char* file;
    uint32_t line;
}EErrorStruct,*EError;
#define THROW_ERROR(message, ...) { EError __err=GET_MESSAGE(Message_Error,(char*)__FILE__,__LINE__,message,##__VA_ARGS__); SEND_MESSAGE(__err); return __err;}
#define TRY(__x) { EError __err = __x; if (__err->message_type==Message_Error) { return __err;}}
#define TRYHAL(__x) { HAL_StatusTypeDef __res = __x; if (__res != HAL_OK) { THROW_ERROR("HAL problem: %u",__res);}}
#define TRYFAT(__x) { FRESULT __res = __x; if (__res != FR_OK) { THROW_ERROR("FAT problem: %u",__res);}}
#define NO_ERROR() { return GET_MESSAGE(Message_None,NULL,0,NULL,0);}
#define SEND_ERROR(message , ...) { SEND_MESSAGE(GET_MESSAGE(Message_Error,(char*)__FILE__,__LINE__,message,##__VA_ARGS__)); }
#define SEND_WARN(message , ...) { SEND_MESSAGE(GET_MESSAGE(Message_Warning,(char*)__FILE__,__LINE__,message,##__VA_ARGS__)); }
#define SEND_INFO(message , ...) { SEND_MESSAGE(GET_MESSAGE(Message_Info,(char*)__FILE__,__LINE__,message,##__VA_ARGS__)); }
EError GET_MESSAGE(EMessage_type messagetype,const char* file, uint32_t line,const char *format, ... );
void SEND_MESSAGE(EError err);
uint8_t ISFAILED(EError err);
#endif /* ERROR_H_ */
The source file
#include <error.h>
#include "stdio.h"
#include "stdarg.h"
static EErrorStruct error;
static const EError m = &error;
static char buffer[300];
EError GET_MESSAGE(EMessage_type messagetype,const char* file, uint32_t line,const char *format, ... )
{
    va_list args;
    va_start(args,format);
    vsprintf(buffer, format, args);
    va_end(args);
    m->message = buffer;
    m->message_type = messagetype;
    m->file = file;
    m->line = line;
    return m;
}
void SEND_MESSAGE(EError err)
{
    switch (err->message_type) {
        case Message_Error:
            printf("ERRO: %s \r\n\t\t\t\t\t\t\t\t\t\t at %s line: %u\r\n",err->message,err->file,(unsigned int)err->line);
            break;
        case Message_Warning:
            printf("WARN: %s \r\n\t\t\t\t\t\t\t\t\t\t at %s line: %u\r\n",err->message,err->file,(unsigned int)err->line);
            break;
        case Message_Info:
            printf("INFO: %s \r\n\t\t\t\t\t\t\t\t\t\t at %s line: %u\r\n",err->message,err->file,(unsigned int)err->line);
            break;
        default:
            break;
    }
}
uint8_t ISFAILED(EError err)
{
    if (err->message_type == Message_Error) return 1;
return 0;
}