PO: minor error logging improvements

This commit is contained in:
teo_sarca 2008-08-18 08:35:21 +00:00
parent ec6f0ea17c
commit 796538357d
2 changed files with 17 additions and 4 deletions

View File

@ -1908,7 +1908,7 @@ public abstract class PO
catch (Exception e) catch (Exception e)
{ {
log.log(Level.WARNING, "beforeSave - " + toString(), e); log.log(Level.WARNING, "beforeSave - " + toString(), e);
log.saveError("Error", e.toString(), false); log.saveError("Error", e, false);
if (localTrx != null) { if (localTrx != null) {
localTrx.rollback(); localTrx.rollback();
localTrx.close(); localTrx.close();
@ -2017,7 +2017,7 @@ public abstract class PO
catch (Exception e) catch (Exception e)
{ {
log.log(Level.WARNING, "afterSave", e); log.log(Level.WARNING, "afterSave", e);
log.saveError("Error", e.toString(), false); log.saveError("Error", e, false);
success = false; success = false;
// throw new DBException(e); // throw new DBException(e);
} }
@ -2703,7 +2703,7 @@ public abstract class PO
catch (Exception e) catch (Exception e)
{ {
log.log(Level.WARNING, "beforeDelete", e); log.log(Level.WARNING, "beforeDelete", e);
log.saveError("Error", e.toString(), false); log.saveError("Error", e, false);
// throw new DBException(e); // throw new DBException(e);
return false; return false;
} }
@ -2800,7 +2800,7 @@ public abstract class PO
catch (Exception e) catch (Exception e)
{ {
log.log(Level.WARNING, "afterDelete", e); log.log(Level.WARNING, "afterDelete", e);
log.saveError("Error", e.toString(), false); log.saveError("Error", e, false);
success = false; success = false;
// throw new DBException(e); // throw new DBException(e);
} }

View File

@ -120,6 +120,19 @@ public class CLogger extends Logger implements Serializable
return saveError (AD_Message, ex.getLocalizedMessage(), true); return saveError (AD_Message, ex.getLocalizedMessage(), true);
} // saveError } // saveError
/**
* Set and issue (if specified) Error and save as ValueNamePair
* @param AD_Message message key
* @param ex exception
* @param issueError if true will issue an error
* @return true (to avoid removal of method)
*/
public boolean saveError (String AD_Message, Exception ex, boolean issueError)
{
Env.getCtx().put(LAST_EXCEPTION, ex);
return saveError (AD_Message, ex.getLocalizedMessage(), issueError);
} // saveError
/** /**
* Set Error and save as ValueNamePair * Set Error and save as ValueNamePair
* @param AD_Message message key * @param AD_Message message key