public AutoIndexingKernelException( KernelException cause ) { super( cause.status(), cause, cause.getMessage() ); } }
@Test public void databasePanicIsRaisedWhenTxApplicationFails() throws Throwable { RecordStorageEngine engine = buildRecordStorageEngine(); Exception applicationError = executeFailingTransaction( engine ); ArgumentCaptor<Exception> captor = ArgumentCaptor.forClass( Exception.class ); verify( databaseHealth ).panic( captor.capture() ); Throwable exception = captor.getValue(); if ( exception instanceof KernelException ) { assertThat( ((KernelException) exception).status(), is( Status.General.UnknownError ) ); exception = exception.getCause(); } assertThat( exception, is( applicationError ) ); }
private Stream<BuiltInProcedures.SchemaIndexInfo> createIndex( String indexSpecification, String providerName, String statusMessage, IndexCreator indexCreator ) throws ProcedureException { assertProviderNameNotNull( providerName ); IndexSpecifier index = IndexSpecifier.byPattern( indexSpecification ); int labelId = getOrCreateLabelId( index.label() ); int[] propertyKeyIds = getOrCreatePropertyIds( index.properties() ); try { SchemaWrite schemaWrite = ktx.schemaWrite(); LabelSchemaDescriptor labelSchemaDescriptor = SchemaDescriptorFactory.forLabel( labelId, propertyKeyIds ); indexCreator.create( schemaWrite, labelSchemaDescriptor, providerName ); return Stream.of( new BuiltInProcedures.SchemaIndexInfo( indexSpecification, providerName, statusMessage ) ); } catch ( InvalidTransactionTypeKernelException | SchemaKernelException e ) { throw new ProcedureException( e.status(), e, e.getMessage() ); } }
assertEquals( Status.Schema.ConstraintAlreadyExists, e.status() );
public AutoIndexingKernelException( KernelException cause ) { super( cause.status(), cause, cause.getMessage() ); } }
public static <T> T throwKernelException(KernelException e) { Status status = e.status(); String codeString = status.code().serialize(); String message = e.getMessage(); String newMessage; if (message == null || message.isEmpty()) { newMessage = codeString; } else { newMessage = codeString + ": " + message; } throw new RuntimeException(newMessage, e); }
public static <T> T throwKernelException(KernelException e) { Status status = e.status(); String codeString = status.code().serialize(); String message = e.getMessage(); String newMessage; if (message == null || message.isEmpty()) { newMessage = codeString; } else { newMessage = codeString + ": " + message; } throw new RuntimeException(newMessage, e); }
private Stream<BuiltInProcedures.SchemaIndexInfo> createIndex( String indexSpecification, String providerName, String statusMessage, IndexCreator indexCreator ) throws ProcedureException { assertProviderNameNotNull( providerName ); IndexSpecifier index = IndexSpecifier.byPattern( indexSpecification ); int labelId = getOrCreateLabelId( index.label() ); int[] propertyKeyIds = getOrCreatePropertyIds( index.properties() ); try { SchemaWrite schemaWrite = ktx.schemaWrite(); LabelSchemaDescriptor labelSchemaDescriptor = SchemaDescriptorFactory.forLabel( labelId, propertyKeyIds ); indexCreator.create( schemaWrite, labelSchemaDescriptor, providerName ); return Stream.of( new BuiltInProcedures.SchemaIndexInfo( indexSpecification, providerName, statusMessage ) ); } catch ( InvalidTransactionTypeKernelException | SchemaKernelException e ) { throw new ProcedureException( e.status(), e, e.getMessage() ); } }