# Debug a failable function

**URL:** <https://forums.unrealengine.com/t/debug-a-failable-function/1251290>\
**Category:** Verse\
**Tags:** debug, unreal-editor-for-fortnite, fortnite-creative, fortnite\
**Created:** [August 5, 2023, 2:45am UTC](https://forums.unrealengine.com/t/debug-a-failable-function/1251290 "2023-08-05T02:45:09Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Orodex](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Orodex](https://forums.unrealengine.com/u/Orodex)\
**Post date:** [August 5, 2023, 2:45am UTC](https://forums.unrealengine.com/t/debug-a-failable-function/1251290/1 "2023-08-05T02:45:09Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Roy\_Wierer.Seda145](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/roy_wierer.seda145/32/906551_2.png) [@Roy\_Wierer.Seda145](https://forums.unrealengine.com/u/Roy_Wierer.Seda145)\
**Post date:** [August 5, 2023, 3:26am UTC](https://forums.unrealengine.com/t/debug-a-failable-function/1251290/2 "2023-08-05T03:26:22Z")

</div>

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](https://docs.unrealengine.com/4.27/en-US/ProgrammingAndScripting/ProgrammingWithCPP/Assertions/)

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

> [@Orodex](#):
>
> rewrite the whole thing with options just to debug it

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.

---

<div class="post-metadata">

**Author:** ![Orodex](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Orodex](https://forums.unrealengine.com/u/Orodex)\
**Post date:** [August 5, 2023, 5:47am UTC](https://forums.unrealengine.com/t/debug-a-failable-function/1251290/3 "2023-08-05T05:47:51Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Orodex](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Orodex](https://forums.unrealengine.com/u/Orodex)\
**Post date:** [August 11, 2023, 5:54am UTC](https://forums.unrealengine.com/t/debug-a-failable-function/1251290/5 "2023-08-11T05:54:49Z")

</div>

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

> **[Project-wide Logger | Uefn Code Snippet](https://dev.epicgames.com/community/snippets/p8N2/fortnite-project-wide-logger)**
>
> A project-wide "Logger" to print messages from functions that are not in a class with a log.

---

<div class="post-metadata">

**Author:** ![ManualPotato](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/manualpotato/32/1144902_2.png) [@ManualPotato](https://forums.unrealengine.com/u/ManualPotato)\
**Post date:** [August 11, 2023, 8:45am UTC](https://forums.unrealengine.com/t/debug-a-failable-function/1251290/6 "2023-08-11T08:45:18Z")

</div>

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