MCPcopy Create free account
hub / github.com/devkitPro/libctru / ERRF_ThrowResultWithMessage

Function ERRF_ThrowResultWithMessage

libctru/source/errf.c:109–134  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

107}
108
109Result ERRF_ThrowResultWithMessage(Result failure, const char* message)
110{
111 ERRF_FatalErrInfo error;
112 Result ret;
113
114 if (R_FAILED(ret = errfInit()))
115 return ret;
116
117 memset(&error, 0, sizeof(error));
118
119 error.type = ERRF_ERRTYPE_FAILURE;
120 getCommonErrorData(&error, failure);
121
122#pragma GCC diagnostic push
123#pragma GCC diagnostic ignored "-Wstringop-truncation"
124 // Official client code always copies at most 95 bytes + NUL byte, but server codes uses %.96s
125 // and explicitely handles 96 non-NUL bytes.
126 strncpy(error.data.failure_mesg, message, sizeof(error.data.failure_mesg));
127#pragma GCC diagnostic pop
128
129 ret = ERRF_Throw(&error);
130
131 errfExit();
132
133 return ret;
134}
135
136Result ERRF_SetUserString(const char* user_string)
137{

Callers

nothing calls this directly

Calls 4

errfInitFunction · 0.85
getCommonErrorDataFunction · 0.85
ERRF_ThrowFunction · 0.85
errfExitFunction · 0.85

Tested by

no test coverage detected