Skip to content

Instantly share code, notes, and snippets.

@Vavius
Created June 5, 2015 18:24
Show Gist options
  • Save Vavius/5c25e0b6f0c4b6bdd944 to your computer and use it in GitHub Desktop.
Save Vavius/5c25e0b6f0c4b6bdd944 to your computer and use it in GitHub Desktop.
TracebackHandler = function(err)
local err = err or ''
local task = MOAIHttpTask.new()
local str = STP and STP.stacktrace() or debug.traceback()
local trace = err .. '\n' .. str
local params = {}
params.err = err
params.error = trace
params.os = MOAIEnvironment.osBrand
params.osVersion = MOAIEnvironment.osVersion
params.gameVersion = MOAIEnvironment.appVersion
params.devModel = MOAIEnvironment.devModel
local body = {
data = params
}
task:setUrl("http://example.com/tracebacks")
task:setVerb(MOAIHttpTask.HTTP_POST)
task:setHeader("Content-Type", "application/json")
task:setBody(MOAIJsonParser.encode(body))
task:setTimeout(10)
task:setCallback(function(task, code)
log.info('Send traceback result: ', code)
log.info(task:getString())
end)
task:performSync()
end
MOAISim.setTraceback(TracebackHandler)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment