Skip to content

Commit de20a16

Browse files
Added error.h/c from frogrammer9/BigOs:main
1 parent 01752a2 commit de20a16

2 files changed

Lines changed: 28 additions & 0 deletions

File tree

include/stdbigos/error.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// Copy form frogrammer9/BigOs as we might want to use this
2+
3+
#ifndef _STDBIGOS_ERROR_H_
4+
#define _STDBIGOS_ERROR_H_
5+
6+
typedef enum {
7+
ERR_NONE = 0,
8+
ERR_INVALID_ARGUMENT,
9+
ERR_CRITICAL_INTERNAL_FAILURE,
10+
ERR_HARDWARE_NOT_COMPATIBLE,
11+
ERR_ALL_ADDRESS_SPACES_IN_USE,
12+
ERR_PHISICAL_MEMORY_FULL,
13+
} error_t;
14+
15+
const char* get_error_msg(error_t err);
16+
17+
#endif //_STDBIGOS_ERROR_H_

src/lib/stdbigos/error.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// Copy form frogrammer9/BigOs as we might want to use this
2+
3+
#include <stdbigos/error.h>
4+
5+
const char* get_error_msg(error_t err) {
6+
switch(err) {
7+
case ERR_NONE: return "";
8+
case ERR_INVALID_ARGUMENT: return "Invalid argument";
9+
default: return "Error message was not provided";
10+
}
11+
}

0 commit comments

Comments
 (0)