Login
cgi-proxy.th1ish at [8a4665bffa]
Login

File th1ish/cgi-proxy.th1ish artifact c55bc9d7f2 part of check-in 8a4665bffa


/**

*/
assert api.cgi
const ob = api.ob
ob.push()
const obLevel = ob.level()
var err = catch{
    api.import('cgi/init')
    api.cgi.dispatchRoute()
}
while( ob.level() > obLevel){
    ob.pop() // discard accumulated output
}
// we are only here if an exception is thrown because it exit()s on success
//api.ob.level() && api.ob.clear()
if(api.cgi.httpStatus() < 500){
    api.cgi.httpStatus(500, "Caught Exception")
}
api.cgi.scrubException && (err = api.cgi.scrubException(err))
api.cgi.setContentType('application/json')
print("%1$-1J".applyFormat(object{exception:err}))
api.cgi.send()