Debug.traceback starts at xpcall and not the function xpcall called

	local success , result = xpcall( self:RenewGui(), 
		function(err)
			warn(tostring(err) .. "\n" .. debug.traceback())
			return false, err
	end)

From this i was expecting to get the error from the line in which the function for self:RenewGui() is, but traceback starts at the line in which xpcall happens for some reason, not in the line in which the actual error occurs.

Have you tried toying around with the stack level?

Yes, but it doesn’t seem to be working right, it starts from the xpcall and makes it’s way up the scopes.

Try performing the call to “debug.traceback()” inside the function which is being called inside of the call to “xpcall”.

Ok, I fixed the function already but I still want to figure this out, debug.traceback would go before or after the line that errors?

Before, if the script breaks before calling “debug.traceback()” then the call won’t be performed.

Ok, I forgot to place it inside a warn() and it didn’t do anything but it work now.