Пример #1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void handleFailure(Throwable cause, boolean fatal) throws org.neo4j.bolt.runtime.BoltConnectionFatality
        public override void HandleFailure(Exception cause, bool fatal)
        {
            if (ExceptionUtils.indexOfType(cause, typeof(BoltConnectionFatality)) != -1)
            {
                fatal = true;
            }

            Neo4jError error = fatal ? Neo4jError.fatalFrom(cause) : Neo4jError.from(cause);

            Fail(error);

            if (error.Fatal)
            {
                if (ExceptionUtils.indexOfType(cause, typeof(AuthorizationExpiredException)) != -1)
                {
                    throw new BoltConnectionAuthFatality("Failed to process a bolt message", cause);
                }
                if (cause is AuthenticationException)
                {
                    throw new BoltConnectionAuthFatality(( AuthenticationException )cause);
                }

                throw new BoltConnectionFatality("Failed to process a bolt message", cause);
            }
        }
Пример #2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void nextState(org.neo4j.bolt.messaging.RequestMessage message, org.neo4j.bolt.runtime.StateMachineContext context) throws org.neo4j.bolt.runtime.BoltConnectionFatality
        private void NextState(RequestMessage message, StateMachineContext context)
        {
            BoltStateMachineState preState = _state;

            _state = _state.process(message, context);
            if (_state == null)
            {
                string msg = "Message '" + message + "' cannot be handled by a session in the " + preState.Name() + " state.";
                Fail(Neo4jError.fatalFrom(Org.Neo4j.Kernel.Api.Exceptions.Status_Request.Invalid, msg));
                throw new BoltProtocolBreachFatality(msg);
            }
        }
Пример #3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void databaseErrorShouldLogFullMessageInDebugLogAndHelpfulPointerInUserLog()
        public virtual void DatabaseErrorShouldLogFullMessageInDebugLogAndHelpfulPointerInUserLog()
        {
            // given
            AssertableLogProvider userLog     = new AssertableLogProvider();
            AssertableLogProvider internalLog = new AssertableLogProvider();
            ErrorReporter         reporter    = NewErrorReporter(userLog, internalLog);

            Neo4jError error = Neo4jError.fatalFrom(new TestDatabaseError());

            System.Guid reference = error.Reference();

            // when
            reporter.Report(error);

            // then
            userLog.RawMessageMatcher().assertContains("Client triggered an unexpected error");
            userLog.RawMessageMatcher().assertContains(reference.ToString());
            userLog.RawMessageMatcher().assertContains("Database error");

            internalLog.RawMessageMatcher().assertContains(reference.ToString());
            internalLog.RawMessageMatcher().assertContains("Database error");
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldLogOriginalFatalErrorWhenOutputIsClosed() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldLogOriginalFatalErrorWhenOutputIsClosed()
        {
            TestLoggingOfOriginalErrorWhenOutputIsClosed(Neo4jError.fatalFrom(new Exception("Fatal error")));
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldLogWriteErrorAndOriginalFatalErrorWhenUnknownFailure() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldLogWriteErrorAndOriginalFatalErrorWhenUnknownFailure()
        {
            TestLoggingOfWriteErrorAndOriginalErrorWhenUnknownFailure(Neo4jError.fatalFrom(new Exception("Fatal error")));
        }