Programming Assistant for Exception Handling with CodeBERT
Yuchen Cai, Aashish Yadavally, Abhishek Mishra, Genesis Montejo, Tien N. Nguyen
Abstract
With practical code reuse, the code fragments from developers' forums often migrate to applications. Owing to the incomplete nature of such fragments, they often lack the details on exception handling. The adaptation for exception handling to the codebase is not trivial as developers must learn and memorize what API methods could cause exceptions and what exceptions need to be handled. We propose Neurex, an exception handling recommender that learns from complete code, and accepts a given Java code snippet and recommends 1) if a try-catch block is needed, 2) what statements need to be placed in a try block, and 3) what exception types need to be caught in the catch clause. Inspired by the sequence chunking techniques in natural language processing, we design Neurex via a multi-tasking model with the fine-tuning of the large language model CodeBERT for these three exception handling recommendation tasks. Via the large language model, Neurex can learn the surrounding context, leading to better learning the dependencies among the API elements, and the relations between the statements and the corresponding exception types needed to be handled.
Ask about this paper
Ask your agent about it.
Lune has read the top-tier papers around this one, so every answer names the papers it rests on.
Your agent calls
Lunesearch_papers
Free to start. No credit card required.
Terminal
Install the CLIlune papers get d8143ed5-12a5-4c01-ba0e-374d7f6fae26Cited by top-tier papers5
- iSMELL: Assembling LLMs with Expert Toolsets for Code Smell Detection and RefactoringDi Wu, Fangwen Mu, Lin Shi, Zhaoqiang Guo et al.ASE 2024 · 19 citations
- BERT-Based Code Learning for Exception Localization and Type PredictionChongyu Zhang, Qiping Tao, Liangyu Chen, Min ZhangAAAI 2025 · 1 citation
- From Seed to Scope: Reasoning to Identify Change Impact SetsAashish Yadavally, Tien N. NguyenICSE 2026 · 1 citation
- Large Language Model-Aided Partial Program Dependence AnalysisXiaokai Rong, Aashish Yadavally, Tien N. NguyenICSE 2026 · 1 citation
- AdaptAgent: A Multi-agent, Domain-Guided Reasoning Framework for Code AdaptationXiaokai Rong, Hridya Dhulipala, Aashish Yadavally, Tien N. NguyenISSTA 2026
Related papers
- Learning to Handle ExceptionsJian Zhang, Xu Wang, Hongyu Zhang, Hailong Sun et al.ASE 2020 · 19 citations
- From Misuse to Mastery: Enhancing Code Generation with Knowledge-Driven AI ChainingXiaoxue Ren, Xinyuan Ye, Dehai Zhao, Zhenchang Xing et al.ASE 2023 · 28 citations
- Code recommendation for exception handlingTam Nguyen, Phong Vu, Tung NguyenFSE 2020 · 22 citations
- An Empirical Study on Fine-Tuning Large Language Models of Code for Automated Program RepairKai Huang, Xiangxin Meng, Jian Zhang, Yang Liu et al.ASE 2023 · 91 citations
- Which Exception Shall We Throw?Hao ZhongASE 2022 · 5 citations
