Created
June 5, 2015 18:24
-
-
Save Vavius/5c25e0b6f0c4b6bdd944 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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