throw new ProcedureException( ((Status.HasStatus) throwable).status(), throwable, throwable.getMessage() );
throw new ProcedureException( ((Status.HasStatus) throwable).status(), throwable, throwable.getMessage() );
errors.add( new Neo4jError( ((Status.HasStatus) e.getCause()).status(), e ) );
Code statusCode = e.status().code(); if ( statusCode.classification() == Classification.TransientError )
throw new AuthenticationException( e.status(), e.getMessage(), e );
throw new ProcedureException( ((Status.HasStatus) throwable).status(), throwable, throwable.getMessage(), throwable );
private static Neo4jError fromThrowable( Throwable any, boolean isFatal ) { for ( Throwable cause = any; cause != null; cause = cause.getCause() ) { if ( cause instanceof Status.HasStatus ) { return new Neo4jError( ((Status.HasStatus) cause).status(), any.getMessage(), any, isFatal ); } if ( cause instanceof DatabaseShutdownException ) { return new Neo4jError( Status.General.DatabaseUnavailable, cause, isFatal ); } if ( cause instanceof OutOfMemoryError ) { return new Neo4jError( Status.General.OutOfMemoryError, cause, isFatal ); } if ( cause instanceof StackOverflowError ) { return new Neo4jError( Status.General.StackOverFlowError, cause, isFatal ); } } // In this case, an error has "slipped out", and we don't have a good way to handle it. This indicates // a buggy code path, and we need to try to convince whoever ends up here to tell us about it. return new Neo4jError( Status.General.UnknownError, any != null ? any.getMessage() : null, any, isFatal ); }
public Neo4jError translate( Throwable any ) { for( Throwable cause = any; cause != null; cause = cause.getCause() ) { if ( cause instanceof Status.HasStatus ) { return new Neo4jError( ((Status.HasStatus) cause).status(), any.getMessage() ); } } // In this case, an error has "slipped out", and we don't have a good way to handle it. This indicates // a buggy code path, and we need to try to convince whoever ends up here to tell us about it. // TODO: Perhaps move this whole block to somewhere more sensible? String reference = UUID.randomUUID().toString(); // 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( any, reference ) ), any ); internalLog.error( String.format( "Client triggered unexpected error, reference %s.", reference), any ); return new Neo4jError( Status.General.UnknownFailure, String.format( "An unexpected failure occurred, see details in the database " + "logs, reference number %s.%n%s", reference, Exceptions.stringify( any ) ) ); }
@Override public Object result() throws ProcedureException { try { return typeChecker.typeCheck( resultMethod.invoke(aggregator) ); } catch ( Throwable throwable ) { if ( throwable instanceof Status.HasStatus ) { throw new ProcedureException( ((Status.HasStatus) throwable).status(), throwable, throwable.getMessage() ); } else { Throwable cause = ExceptionUtils.getRootCause( throwable ); throw new ProcedureException( Status.Procedure.ProcedureCallFailed, throwable, "Failed to invoke function `%s`: %s", signature.name(), "Caused by: " + (cause != null ? cause : throwable) ); } } }
private ProcedureException newProcedureException( Throwable throwable ) { // Unwrap the wrapped exception we get from invocation by reflection if ( throwable instanceof InvocationTargetException ) { throwable = throwable.getCause(); } if ( throwable instanceof Status.HasStatus ) { return new ProcedureException( ((Status.HasStatus) throwable).status(), throwable, throwable.getMessage() ); } else { Throwable cause = ExceptionUtils.getRootCause( throwable ); return new ProcedureException( Status.Procedure.ProcedureCallFailed, throwable, "Failed to invoke procedure `%s`: %s", signature.name(), "Caused by: " + (cause != null ? cause : throwable) ); } } }
private static Status statusCode( Throwable current ) { while ( current != null ) { if ( current instanceof Status.HasStatus ) { return ((Status.HasStatus) current).status(); } if ( current instanceof ConstraintViolationException ) { return Status.Schema.ConstraintValidationFailed; } current = current.getCause(); } return Status.General.UnknownError; } }
static Status statusCodeOf( Throwable e ) { do { if ( e instanceof Status.HasStatus ) { return ((Status.HasStatus) e).status(); } e = e.getCause(); } while ( e != null ); return null; } }
public static Neo4jError from( Throwable any ) { for( Throwable cause = any; cause != null; cause = cause.getCause() ) { if ( cause instanceof Status.HasStatus ) { return new Neo4jError( ((Status.HasStatus) cause).status(), any.getMessage(), any ); } } // In this case, an error has "slipped out", and we don't have a good way to handle it. This indicates // a buggy code path, and we need to try to convince whoever ends up here to tell us about it. return new Neo4jError( Status.General.UnknownFailure, any.getMessage(), any ); }
public <EX extends Throwable & Status.HasStatus> QueryExecutionKernelException( EX cause ) { super( cause.status(), cause, cause.getMessage() ); }
throw new ProcedureException( ((Status.HasStatus) throwable).status(), throwable, throwable.getMessage() );
Code statusCode = e.status().code(); if ( statusCode.classification() == Classification.TransientError )
errors.add( new Neo4jError( ((Status.HasStatus) e.getCause()).status(), e ) );
throw new ProcedureException( ((Status.HasStatus) throwable).status(), throwable, throwable.getMessage() );