Homebrew Discussion Switch Homebrew Error Decoder for c++

dangarbri

Member
OP
Newcomer
Joined
May 13, 2020
Messages
5
Trophies
0
Age
29
XP
51
Country
United States
Sharing some code I wrote to help with debugging homebrew apps.
I'm new to homebrew dev, so still figuring out libnx. Someone could probably tell me how there's a much better way to do this, but here's what I've got.

A bunch of libnx calls return a Result code which is just some numbers that you need to look up on dev kit pro wiki.
So save time trying to lookup error codes, I have some code to just print the error string to console.
Added a build flag to enable it since it's a ton of strings that will bloat the app size.

so basically the idea is you would compile with -DENABLE_ERROR_CODE_PRINTS
Then write something like:
Code:
Result result = someLibnxApiCall();
if (R_FAILED(result)) {
    ERROR_RESULT_PRINT(result)
}
And it would print something like:
Code:
Error: 0x0E01 Module ID: 1, Module Description: 7
Message: Session count exceeded
The top message would be printed even if the flag is disabled
The bottom message is the lookup, so is only compiled in with the build flag
 

Attachments

  • error_string.zip
    13.2 KB · Views: 256
Last edited by dangarbri,
  • Like
Reactions: hippy dave and JK_

masagrator

The patches guy
Developer
Joined
Oct 14, 2018
Messages
6,270
Trophies
3
XP
12,037
Country
Poland
There is Error Code bot for Discord. You just write f.e.
Code:
.serr 0xE01

And you get what this error means.
RetroNX is one of discord channels that have it.
IMG_20200515_073702.jpg

Issue with error list is that it constantly changes or adds new descriptions. So better not implement text prints for it.
 
Last edited by masagrator,

dangarbri

Member
OP
Newcomer
Joined
May 13, 2020
Messages
5
Trophies
0
Age
29
XP
51
Country
United States
There is Error Code bot for Discord. You just write f.e.
Code:
.serr 0xE01

And you get what this error means.
RetroNX is one of discord channels that have it.
View attachment 209098

Issue with error list is that it constantly changes or adds new descriptions. So better not implement text prints for it.

Oh nice, thanks.

Does the error list really change that often? I'd imagine error lists to be pretty constant, besides maybe new messages being added, but existing errors shouldn't really change.

I guess this list will be short-lived. But I still think it's nicer to have console prints.
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    Sonic Angel Knight @ Sonic Angel Knight: New Ninja in chat