Debug a failable function

If you’re writing a failable function, and you find that it is failing when you don’t want it to, how are you supposed to debug it?

Breakpoints are not in yet
Cant print in no_rollback
No error logs available

like… am I supposed to genuinely rewrite the whole thing with options just to debug it?

Verse? Not familiar with it. Normally if you have a function which can fail but may not fail, you assert. This is meant to be both a debugging tool and to prevent corruption and is used in c++.

Asserts | Unreal Engine 4.27 Documentation

Can’t tell if verse has anything like that, would be awful if it doesn’t.

Sometimes it is like that. UE has various debugging tools, again I don’t know verse so I can’t tell what it can access but if what you are going to debug is more than printing a string or two (a big system) then a cleaner approach might be to use the debug tools in an editor module.

Usually debugging is just ugly.

This is specifically a Verse question and a Verse problem. Verse doesn’t include any Assert, and in this specific problem, it’s likely would not be possible to call an assert as the context would not even allow it.

Since nobody seems to know this, I found a solution, just use this code snippet made by staff:

2 Likes

Is it creating a logger instance every time log is called intentional?