private static Status.Code newStatusCode( Status.Classification classification ) { Status.Code code = mock( Status.Code.class ); when( code.classification() ).thenReturn( classification ); return code; }
@Override public void validateTransaction() throws KernelException { KernelTransaction tx = ctx.currentTransaction; if ( tx != null ) { Optional<Status> statusOpt = tx.getReasonIfTerminated(); if ( statusOpt.isPresent() ) { if ( statusOpt.get().code().classification().rollbackTransaction() ) { ctx.pendingTerminationNotice = statusOpt.get(); reset(); } } } }
public static boolean shouldRollBackOn( Collection<Neo4jError> errors ) { if ( errors.isEmpty() ) { return false; } for ( Neo4jError error : errors ) { if ( error.status().code().classification().rollbackTransaction() ) { return true; } } return false; } }
if( err.status().code().classification().rollbackTransaction() || ctx.implicitTransaction )
if ( statusCode.classification() == Classification.TransientError )
/** * Writes logs about database errors. * Short one-line message is written to both user and internal log. * Large message with stacktrace (if available) is written to internal log. * * @param error the error to log. * @see StoreLogService * @see DuplicatingLogProvider */ public void report( Neo4jError error ) { if ( error.status().code().classification() == DatabaseError ) { String message = format( "Client triggered an unexpected error [%s]: %s, reference %s.", error.status().code().serialize(), error.message(), error.reference() ); // Writing to user log gets duplicated to the internal log userLog.error( message ); // If cause/stacktrace is available write it to the internal log if ( error.cause() != null ) { debugLog.error( message, error.cause() ); } } } }
@Override public void validateTransaction() throws KernelException { KernelTransaction tx = ctx.currentTransaction; if ( tx != null ) { Optional<Status> statusOpt = tx.getReasonIfTerminated(); if ( statusOpt.isPresent() ) { if ( statusOpt.get().code().classification().rollbackTransaction() ) { ctx.pendingTerminationNotice = statusOpt.get(); reset(); } } } }
public static boolean shouldRollBackOn( Collection<Neo4jError> errors ) { if ( errors.isEmpty() ) { return false; } for ( Neo4jError error : errors ) { if ( error.status().code().classification().rollbackTransaction() ) { return true; } } return false; } }
public boolean shouldSerializeStackTrace() { switch ( status.code().classification() ) { case ClientError: return false; default: return true; } }
/** Forward an error to the currently attached callback */ private void error( Neo4jError err ) { if( err.status().code().classification() == Status.Classification.DatabaseError ) { log.error( "A database error occurred while servicing a user request: " + err ); } if ( currentCallback != null ) { currentCallback.failure( err, currentAttachment ); } }
public void report( Neo4jError error ) { if ( !error.status().code().classification().publishable() ) { // Log unknown errors. userLog.error( String.format( "Client triggered unexpected error. Help us fix this error by emailing the " + "following report to issues@neotechnology.com: %n%s", generateReport( error ) ) ); } }
/** Forward an error to the currently attached callback */ private void error( Neo4jError err ) { if( err.status().code().classification() == Status.Classification.DatabaseError ) { log.error( "A database error occurred while servicing a user request: " + err ); } if ( currentCallback != null ) { currentCallback.failure( err, currentAttachment ); } }
if ( statusCode.classification() == Classification.TransientError )
/** * Writes logs about database errors. * Short one-line message is written to both user and internal log. * Large message with stacktrace (if available) is written to internal log. * * @param error the error to log. * @see StoreLogService * @see DuplicatingLogProvider */ public void report( Neo4jError error ) { if ( error.status().code().classification() == DatabaseError ) { String message = format( "Client triggered an unexpected error [%s]: %s, reference %s.", error.status().code().serialize(), error.message(), error.reference() ); // Writing to user log gets duplicated to the internal log userLog.error( message ); // If cause/stacktrace is available write it to the internal log if ( error.cause() != null ) { debugLog.error( message, error.cause() ); } } } }
public boolean shouldSerializeStackTrace() { switch ( status.code().classification() ) { case ClientError: return false; default: return true; } }