Improve gen-api to generate throw information