private ProcedureException noSuchFunction( QualifiedName name ) { return new ProcedureException( Status.Procedure.ProcedureNotFound, "There is no function with the name `%s` registered for this database instance. " + "Please ensure you've spelled the function name correctly and that the " + "function is properly deployed.", name ); }
@Override TransactionWriteState upgradeToSchemaWrites() throws InvalidTransactionTypeKernelException { throw new InvalidTransactionTypeKernelException( "Cannot perform schema updates in a transaction that has performed data updates." ); } },
public AutoIndexingKernelException( KernelException cause ) { super( cause.status(), cause, cause.getMessage() ); } }
public String getUserMessage( TokenNameLookup tokenNameLookup ) { return getMessage(); } }
private void assertNodeExists( long sourceNode ) throws EntityNotFoundException { if ( !allStoreHolder.nodeExists( sourceNode ) ) { throw new EntityNotFoundException( EntityType.NODE, sourceNode ); } }
protected KernelException( Status statusCode, Throwable cause, String message, Object... parameters ) { super( (parameters.length > 0) ? String.format( message, parameters ) : message ); this.statusCode = statusCode; initCause( cause ); }
private ProcedureException noSuchProcedure( QualifiedName name ) { return new ProcedureException( Status.Procedure.ProcedureNotFound, "There is no procedure with the name `%s` registered for this database instance. " + "Please ensure you've spelled the procedure name correctly and that the " + "procedure is properly deployed.", name ); }
private static void singleRelationship( Read read, RelationshipScanCursor relationships, long relationship ) throws EntityNotFoundException { read.singleRelationship( relationship, relationships ); if ( !relationships.next() ) { throw new EntityNotFoundException( EntityType.NODE, relationship ); } } }
@Override TransactionWriteState upgradeToDataWrites() throws InvalidTransactionTypeKernelException { throw new InvalidTransactionTypeKernelException( "Cannot perform data updates in a transaction that has performed schema updates." ); } };
private ProcedureException noSuchFunction( int id ) { return new ProcedureException( Status.Procedure.ProcedureNotFound, "There is no function with the internal id `%d` registered for this database instance.", id ); }
private void singleRelationship( long relationship ) throws EntityNotFoundException { allStoreHolder.singleRelationship( relationship, relationshipCursor ); if ( !relationshipCursor.next() ) { throw new EntityNotFoundException( EntityType.RELATIONSHIP, relationship ); } }
private ProcedureException noSuchProcedure( int id ) { return new ProcedureException( Status.Procedure.ProcedureNotFound, "There is no procedure with the internal id `%d` registered for this database instance.", id ); }
private static void singleNode( Read read, NodeCursor nodeCursor, long node ) throws EntityNotFoundException { read.singleNode( node, nodeCursor ); if ( !nodeCursor.next() ) { throw new EntityNotFoundException( EntityType.NODE, node ); } }
public Object typeCheck( Object javaValue ) throws ProcedureException { if ( javaValue == null || javaClass.isInstance( javaValue ) ) { return javaValue; } throw new ProcedureException( Status.Procedure.ProcedureCallFailed, "Expected `%s` to be a `%s`, found `%s`.", javaValue, javaClass.getSimpleName(), javaValue.getClass() ); }
private static void assertProviderNameNotNull( String providerName ) throws ProcedureException { if ( providerName == null ) { throw new ProcedureException( Status.Procedure.ProcedureCallFailed, indexProviderNullMessage() ); } }
@Override public <T> T get( Key<T> key ) throws ProcedureException { Object o = values.get( key.name() ); if ( o == null ) { throw new ProcedureException( Status.Procedure.ProcedureCallFailed, "There is no `%s` in the current procedure call context.", key.name() ); } return (T) o; }
private void waitUntilOnline( IndexReference index, IndexSpecifier indexDescription, long timeout, TimeUnit timeoutUnits ) throws ProcedureException { try { Predicates.awaitEx( () -> isOnline( indexDescription, index ), timeout, timeoutUnits ); } catch ( TimeoutException e ) { throw new ProcedureException( Status.Procedure.ProcedureTimedOut, "Index on %s did not come online within %s %s", indexDescription, timeout, timeoutUnits ); } }
private int getLabelId( String labelName ) throws ProcedureException { int labelId = ktx.tokenRead().nodeLabel( labelName ); if ( labelId == TokenRead.NO_TOKEN ) { throw new ProcedureException( Status.Schema.LabelAccessFailed, "No such label %s", labelName ); } return labelId; }
private String getFailure( IndexSpecifier indexDescription, IndexReference index ) throws ProcedureException { try { return ktx.schemaRead().indexGetFailure( index ); } catch ( IndexNotFoundKernelException e ) { throw new ProcedureException( Status.Schema.IndexNotFound, e, "No such index %s", indexDescription ); } }
private static void rejectEmptyNamespace( QualifiedName name ) throws ProcedureException { if ( name.namespace() == null || name.namespace().length == 0 ) { throw new ProcedureException( Status.Procedure.ProcedureRegistrationFailed, "It is not allowed to define functions in the root namespace please use a namespace, " + "e.g. `@UserFunction(\"org.example.com.%s\")", name.name() ); } }