zoukankan      html  css  js  c++  java
  • java 异常信息返回

    java 对外的异常信息常常需要转化的, 没有必要将错误信息直接抛出。例如

    1. 实际没有信息。 假若是NPE, getMessage(), 将是没有信息。

    2. 太过冗长, 例如一些数据库报错。错误信息很长。 例如:

    ### Error updating database.  Cause: java.sql.SQLIntegrityConstraintViolationException: Duplicate entry 'xxxx' for key 'xxxxxx' ### The error may involve xxxxx.xxx.xxxbatchInsert-Inline ### The error occurred while setting parameters ### SQL: insert into xxx_table(xxx, xx, xxx) values                        (             ?,             ?,             ?,             ?,             ?,             ?,             ?,             ?,             ?,             ?,             ?,             ?,             ?,             ?,             ?,             ?,             ?,             ?,             ?,             ?,             ?,             ?,             ?,             ?,             ?,             ?,             ?,             ?,             NOW(),             NOW(),             0             )          ,              (             ?,             ?,             ?,             ?,             ?,             ?,             ?,             ?,             ?,             ?,             ?,             ?,             ?,             ?,             ?,             ?,             ?, 

    3. 外部不好理解  或者不需要理解

    标题1

    标题1.1

    标题1.1.1

  • 相关阅读:
    在Leangoo里怎么添加,移动列表,修改列表名称?
    在Leangoo里怎么列表示例,插入列表?
    tomcat如何按站点调试本机程序
    ORA-12519, TNS:no appropriate service handler found
    mysql 远程访问
    手机端调试成功笔记
    Cannot find class for bean with name service
    android模拟器不能用键盘
    eclipse使用基础--让toolbar显示自己想要的内容
    mysql解压版安装
  • 原文地址:https://www.cnblogs.com/daixianjun/p/java-exception-msg.html
Copyright © 2011-2022 走看看