-- helper functions

local function removePlayerNameFromStack(stack)
	-- in order to generalize the data so that errors are properly grouped,
	--  we must strip out any personal information from the callstack.
	if not type(stack) == "string" then
		warn(string.format("Expected stack to be a string, received : %s", type(stack)))
		return tostring(stack)
	end

	local sanitizedStack = string.gsub(stack, "Players%.[^.]+%.", "Players.<Player>.")
	return sanitizedStack
end



local ErrorReporter = {}
ErrorReporter.__index = ErrorReporter

function ErrorReporter.new(networkingImpl)
	if not networkingImpl then
		networkingImpl = Networking.new()
	end

	local er = {
		-- reporter implementations
		_googleAnalyticsReporter = ReporterGoogleAnalytics.new({
			networking = networkingImpl,
		}),
		_playFabReporter = ReporterPlayFab.new(),
	}
	setmetatable(er, ErrorReporter)

	return er
end

