local ____lualib = require("lualib_bundle") local __TS__SourceMapTraceBack = ____lualib.__TS__SourceMapTraceBack __TS__SourceMapTraceBack(debug.getinfo(1).short_src, {["5"] = 7,["6"] = 8,["7"] = 7,["10"] = 25,["11"] = 29,["12"] = 29,["13"] = 29,["14"] = 29,["15"] = 30,["16"] = 32,["17"] = 34,["20"] = 37,["21"] = 38,["22"] = 39,["23"] = 40,["24"] = 32,["25"] = 43,["26"] = 43,["27"] = 43,["28"] = 43,["29"] = 48,["30"] = 49,["31"] = 50,["33"] = 52,["35"] = 25}); local ____exports = {} function ____exports.getErrorMessage(self, err) return type(err) == "string" and err or (type(err) == "table" and (err.message or "No Error Message") or "Unknown") end --- This replaces TSTL's try/catch (which uses pcall) -- since it uses xpcall, that captures the FULL traceback. function ____exports.protectedCall(self, params) local ____params_0 = params local fn = ____params_0.fn local onError = ____params_0.onError local errorPrefix = ____params_0.errorPrefix local proError = {type = "ProError", message = "", tracebackPrinted = false} local function errorMsgHandler(err) if type(err) == "table" and err.type == "ProError" and err.tracebackPrinted then return end proError.message = ____exports.getErrorMessage(nil, err) Echo(((errorPrefix or "") .. " ERROR : ") .. proError.message) Echo(debug.traceback()) proError.tracebackPrinted = true end local status, retVal = xpcall( function() return fn(nil) end, function(err) return errorMsgHandler(err) end ) if not status then onError(nil, proError) return {success = false, returnValue = nil} else return {success = true, returnValue = retVal} end end return ____exports