-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patherror_handler.c
56 lines (51 loc) · 2.05 KB
/
error_handler.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* error_handler.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: lbrandy <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/03/17 15:40:37 by lbrandy #+# #+# */
/* Updated: 2021/03/17 16:03:22 by lbrandy ### ########.fr */
/* */
/* ************************************************************************** */
#include "cub3D.h"
static void map_errors(int code)
{
if (code == 0)
write(2, "ERROR:\nminilibx error!\n", 23);
else if (code == 1)
write(2, "ERROR:\nmalloc error!\n", 21);
else if (code == 2)
write(2, "ERROR:\nincorrect resolution!\n", 28);
else if (code == 3)
write(2, "ERROR:\nnot correct path or extension of file!\n", 47);
else if (code == 4)
write(2, "ERROR:\nduplicate data!\n", 23);
else if (code == 5)
write(2, "ERROR:\nbad color!\n", 17);
else if (code == 6)
write(2, "ERROR:\ntrash in file!\n", 22);
else if (code == 7)
write(2, "ERROR:\nspaces in map!\n", 22);
else if (code == 8)
write(2, "ERROR:\nnot enough data!\n", 23);
else if (code == 9)
write(2, "ERROR:\nplayer not found\n", 24);
}
void error_handler(int type_error, int code)
{
if (type_error == 1)
write(2, "ERROR:\nopening error!\n", 24);
if (type_error == 2)
write(2, "ERROR:\nreading error!\n", 24);
if (type_error == 3)
map_errors(code);
if (type_error == 4)
write(2, "ERROR:\nmlx library error!\n", 27); //mlx new window
if (type_error == 5)
write(2, "ERROR:\nargv error!\n", 20);//argv_check
if (type_error == 6)
write(2, "ERROR:\ninvalid third argument\n", 31);
exit(2);
}