Skip to content

Commit

Permalink
Merge pull request #8704 from sheepandshepherd/gdnative_error_printing
Browse files Browse the repository at this point in the history
Add error printing functions to GDNative
  • Loading branch information
karroffel committed May 10, 2017
2 parents 32afcbc + 99e0744 commit 6d0568d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
9 changes: 9 additions & 0 deletions modules/gdnative/godot.cpp
Expand Up @@ -30,6 +30,7 @@
#include "godot.h"

#include "class_db.h"
#include "error_macros.h"
#include "gdnative.h"
#include "global_config.h"
#include "global_constants.h"
Expand Down Expand Up @@ -215,6 +216,14 @@ void GDAPI godot_free(void *p_ptr) {
memfree(p_ptr);
}

void GDAPI godot_print_error(const char *p_description, const char *p_function, const char *p_file, int p_line) {
_err_print_error(p_function, p_file, p_line, p_description, ERR_HANDLER_ERROR);
}

void GDAPI godot_print_warning(const char *p_description, const char *p_function, const char *p_file, int p_line) {
_err_print_error(p_function, p_file, p_line, p_description, ERR_HANDLER_WARNING);
}

#ifdef __cplusplus
}
#endif
4 changes: 4 additions & 0 deletions modules/gdnative/godot.h
Expand Up @@ -404,6 +404,10 @@ void GDAPI *godot_alloc(int p_bytes);
void GDAPI *godot_realloc(void *p_ptr, int p_bytes);
void GDAPI godot_free(void *p_ptr);

//print using Godot's error handler list
void GDAPI godot_print_error(const char *p_description, const char *p_function, const char *p_file, int p_line);
void GDAPI godot_print_warning(const char *p_description, const char *p_function, const char *p_file, int p_line);

#ifdef __cplusplus
}
#endif
Expand Down

0 comments on commit 6d0568d

Please sign in to comment.