Fix: print traceback only on internal error

This commit is contained in:
Nikita Ivanov 2022-06-19 15:57:17 +05:00
parent b5c759a68b
commit 70e79d417c
No known key found for this signature in database
GPG Key ID: 6E656AC5B97B5133
2 changed files with 10 additions and 6 deletions

View File

@ -3,6 +3,8 @@
#include "error.h"
#include "utils.h"
int err_internal_error = 0;
void print_error(const char *error_msg)
{
/* We print errors to stdout because lf file manager

View File

@ -23,12 +23,12 @@
PRINTINTERR(INTERRMSG f "() failed" __VA_OPT__(": %s", __VA_ARGS__))
#ifndef NO_TRACEBACK
#define ERRCHK_PRINT_(...) \
do { \
int __a = 0; \
__VA_OPT__(PRINTINTERR(__VA_ARGS__); __a = 1;) \
if (!__a) \
PRINTINTERR(); \
#define ERRCHK_PRINT_(...) \
do { \
int __a = 0; \
__VA_OPT__(PRINTINTERR(__VA_ARGS__); __a = err_internal_error = 1;) \
if (!__a && err_internal_error) \
PRINTINTERR(); \
} while (0)
#endif
#ifdef NO_TRACEBACK
@ -78,6 +78,8 @@
#define ERRCHK_RET_OK(e) ERRCHK_RET((e) != OK)
#define ERRCHK_GOTO_OK(e, r, l) ERRCHK_GOTO((e) != OK, r, l)
extern int err_internal_error;
enum {
OK,
ERR,