*
* @see #matchErrorState(Map, SQLException)
*/
OpenJPAException narrow(String msg, SQLException ex, Object failed) {
int errorType = matchErrorState(sqlStateCodes, ex);
StoreException storeEx;
switch (errorType) {
case StoreException.LOCK:
storeEx = new LockException(failed);
break;
case StoreException.OBJECT_EXISTS:
storeEx = new ObjectExistsException(msg);
break;
case StoreException.OBJECT_NOT_FOUND:
storeEx = new ObjectNotFoundException(failed);
break;
case StoreException.OPTIMISTIC:
storeEx = new OptimisticException(failed);
break;
case StoreException.REFERENTIAL_INTEGRITY:
storeEx = new ReferentialIntegrityException(msg);
break;
case StoreException.QUERY:
storeEx = new QueryException(msg);
break;
default:
storeEx = new StoreException(msg);
}
storeEx.setFatal(isFatalException(errorType, ex));
return storeEx;
}