title: How do I properly catch and handle PoolInitializationException in Spring Boot Application?
body: <p>I'm writing a Spring Boot 2.6.3 app with a HikariDataSource created programmatically (so I can control names, timeouts, etc.). The interface method is used by a <code>@Configuration</code> class to create the DataSource bean:</p>
  <pre class="lang-java prettyprint-override"><code>public interface DatabaseConfiguration {
      ...
  
      default HikariDataSource asHikariDataSource() {
          HikariConfig config = new HikariConfig();
          config.setUsername(getDatabaseUserAuthentication().getDatabaseUserName());
          config.setPassword(getDatabaseUserAuthentication().getDatabaseUserPassword());
          config.setJdbcUrl(getDatabaseUrl());
          config.setDriverClassName(getDatabaseDriverClass());
          config.setPoolName(getDatabasePoolName());
          config.setConnectionTimeout(getDatabaseConnectionTimeout());
  
          log.info(&quot;Connecting to {}&quot;, getDatabaseDescription());
          HikariDataSource hikariDataSource = new HikariDataSource(config);
          log.info(&quot;Connected to {}&quot;, getDatabaseDescription());
  
          return hikariDataSource;
      }
  }
  
  ...
  
  @Configuration
  public class ConfigureDataSources {
  
      @Bean
      public DataSource getDatabase(LocalDatabaseConfiguration localDatabaseConfiguration) {
          return localDatabaseConfiguration.asHikariDataSource();
      }
  
      ...
  }
  
  </code></pre>
  <p>The application itself is pretty simple, i.e., I haven't altered how the app initializes beans or configures data sources:</p>
  <pre><code>@SpringBootApplication
  public class Application {
      private static ConfigurableApplicationContext context;
  
      public static void main(String[] args) {
          SpringApplication app = new SpringApplication(Application.class);
          context = app.run(args);
      }
  }
  </code></pre>
  <p>If the database is down when I start the app, I get 150+ lines of stacktraces before the app dies:</p>
  <pre><code>2022-05-13 14:56:39.894 ERROR ON-48613Z2 --- [  restartedMain] c.z.h.p.HikariPool                       : Database-Local - Exception during pool initialization.
  com.microsoft.sqlserver.jdbc.SQLServerException: The TCP/IP connection to the host localhost, port 14000 has failed. Error: &quot;Connection refused: no further information. Verify the connection properties. Make sure that an instance of SQL Server is running on the host and accepting TCP/IP connections at the port. Make sure that TCP connections to the port are not blocked by a firewall.&quot;.
      at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(SQLServerException.java:237)
      at com.microsoft.sqlserver.jdbc.SQLServerException.ConvertConnectExceptionToSQLServerException(SQLServerException.java:288)
      at com.microsoft.sqlserver.jdbc.SocketFinder.findSocket(IOBuffer.java:2466)
      at com.microsoft.sqlserver.jdbc.TDSChannel.open(IOBuffer.java:676)
      at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(SQLServerConnection.java:2957)
      at com.microsoft.sqlserver.jdbc.SQLServerConnection.login(SQLServerConnection.java:2628)
      at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectInternal(SQLServerConnection.java:2471)
      at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(SQLServerConnection.java:1470)
      at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(SQLServerDriver.java:915)
      at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:138)
      at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:364)
      at com.zaxxer.hikari.pool.PoolBase.newPoolEntry(PoolBase.java:206)
      at com.zaxxer.hikari.pool.HikariPool.createPoolEntry(HikariPool.java:476)
      at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:561)
      at com.zaxxer.hikari.pool.HikariPool.&lt;init&gt;(HikariPool.java:115)
      at com.zaxxer.hikari.HikariDataSource.&lt;init&gt;(HikariDataSource.java:81)
      at com.example.config.datasource.DatabaseConfiguration.asHikariDataSource(DatabaseConfiguration.java:40)
      at com.example.config.datasource.DataSources.getDatabase(DataSources.java:23)
      at com.example.config.datasource.DataSources$$EnhancerBySpringCGLIB$$755cedd5.CGLIB$getDatabase$1(&lt;generated&gt;)
      at com.example.config.datasource.DataSources$$EnhancerBySpringCGLIB$$755cedd5$$FastClassBySpringCGLIB$$c4b8a483.invoke(&lt;generated&gt;)
      at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:244)
      at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:331)
      at com.example.config.datasource.DataSources$$EnhancerBySpringCGLIB$$755cedd5.getDatabase(&lt;generated&gt;)
      at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
      at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.base/java.lang.reflect.Method.invoke(Method.java:568)
      at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154)
      at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:653)
      at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:638)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1352)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1195)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)
      at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)
      at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
      at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)
      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)
      at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276)
      at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1389)
      at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1309)
      at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:887)
      at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:791)
      at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:541)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1352)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1195)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)
      at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)
      at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
      at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)
      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)
      at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322)
      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)
      at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1154)
      at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:908)
      at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583)
      at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:145)
      at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:732)
      at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:414)
      at org.springframework.boot.SpringApplication.run(SpringApplication.java:302)
      at com.example.Application.main(Application.java:22)
      at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
      at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.base/java.lang.reflect.Method.invoke(Method.java:568)
      at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49)
  2022-05-13 14:56:39.894  WARN ON-48613Z2 --- [  restartedMain] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'dataSourceScriptDatabaseInitializer' defined in class path resource [org/springframework/boot/autoconfigure/sql/init/DataSourceInitializationConfiguration.class]: Unsatisfied dependency expressed through method 'dataSourceScriptDatabaseInitializer' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'getDatabase' defined in class path resource [com.example/config/datasource/DataSources.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.sql.DataSource]: Factory method 'getDatabase' threw exception; nested exception is com.zaxxer.hikari.pool.HikariPool$PoolInitializationException: Failed to initialize pool: The TCP/IP connection to the host localhost, port 14000 has failed. Error: &quot;Connection refused: no further information. Verify the connection properties. Make sure that an instance of SQL Server is running on the host and accepting TCP/IP connections at the port. Make sure that TCP connections to the port are not blocked by a firewall.&quot;.
  2022-05-13 14:56:39.947 ERROR ON-48613Z2 --- [  restartedMain] o.s.b.SpringApplication                  : Application run failed
  org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'dataSourceScriptDatabaseInitializer' defined in class path resource [org/springframework/boot/autoconfigure/sql/init/DataSourceInitializationConfiguration.class]: Unsatisfied dependency expressed through method 'dataSourceScriptDatabaseInitializer' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'getDatabase' defined in class path resource [com.example/config/datasource/DataSources.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.sql.DataSource]: Factory method 'getDatabase' threw exception; nested exception is com.zaxxer.hikari.pool.HikariPool$PoolInitializationException: Failed to initialize pool: The TCP/IP connection to the host localhost, port 14000 has failed. Error: &quot;Connection refused: no further information. Verify the connection properties. Make sure that an instance of SQL Server is running on the host and accepting TCP/IP connections at the port. Make sure that TCP connections to the port are not blocked by a firewall.&quot;.
      at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:800)
      at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:541)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1352)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1195)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)
      at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)
      at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
      at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)
      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)
      at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322)
      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)
      at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1154)
      at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:908)
      at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583)
      at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:145)
      at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:732)
      at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:414)
      at org.springframework.boot.SpringApplication.run(SpringApplication.java:302)
      at com.example.Application.main(Application.java:22)
      at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
      at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.base/java.lang.reflect.Method.invoke(Method.java:568)
      at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49)
  Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'getDatabase' defined in class path resource [com.example/config/datasource/DataSources.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.sql.DataSource]: Factory method 'getDatabase' threw exception; nested exception is com.zaxxer.hikari.pool.HikariPool$PoolInitializationException: Failed to initialize pool: The TCP/IP connection to the host localhost, port 14000 has failed. Error: &quot;Connection refused: no further information. Verify the connection properties. Make sure that an instance of SQL Server is running on the host and accepting TCP/IP connections at the port. Make sure that TCP connections to the port are not blocked by a firewall.&quot;.
      at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:658)
      at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:638)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1352)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1195)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)
      at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)
      at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
      at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)
      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)
      at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276)
      at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1389)
      at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1309)
      at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:887)
      at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:791)
      ... 24 more
  Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.sql.DataSource]: Factory method 'getDatabase' threw exception; nested exception is com.zaxxer.hikari.pool.HikariPool$PoolInitializationException: Failed to initialize pool: The TCP/IP connection to the host localhost, port 14000 has failed. Error: &quot;Connection refused: no further information. Verify the connection properties. Make sure that an instance of SQL Server is running on the host and accepting TCP/IP connections at the port. Make sure that TCP connections to the port are not blocked by a firewall.&quot;.
      at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185)
      at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:653)
      ... 38 more
  Caused by: com.zaxxer.hikari.pool.HikariPool$PoolInitializationException: Failed to initialize pool: The TCP/IP connection to the host localhost, port 14000 has failed. Error: &quot;Connection refused: no further information. Verify the connection properties. Make sure that an instance of SQL Server is running on the host and accepting TCP/IP connections at the port. Make sure that TCP connections to the port are not blocked by a firewall.&quot;.
      at com.zaxxer.hikari.pool.HikariPool.throwPoolInitializationException(HikariPool.java:596)
      at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:582)
      at com.zaxxer.hikari.pool.HikariPool.&lt;init&gt;(HikariPool.java:115)
      at com.zaxxer.hikari.HikariDataSource.&lt;init&gt;(HikariDataSource.java:81)
      at com.example.config.datasource.DatabaseConfiguration.asHikariDataSource(DatabaseConfiguration.java:40)
      at com.example.config.datasource.DataSources.getDatabase(DataSources.java:23)
      at com.example.config.datasource.DataSources$$EnhancerBySpringCGLIB$$755cedd5.CGLIB$getDatabase$1(&lt;generated&gt;)
      at com.example.config.datasource.DataSources$$EnhancerBySpringCGLIB$$755cedd5$$FastClassBySpringCGLIB$$c4b8a483.invoke(&lt;generated&gt;)
      at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:244)
      at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:331)
      at com.example.config.datasource.DataSources$$EnhancerBySpringCGLIB$$755cedd5.getDatabase(&lt;generated&gt;)
      at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
      at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.base/java.lang.reflect.Method.invoke(Method.java:568)
      at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154)
      ... 39 more
  Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: The TCP/IP connection to the host localhost, port 14000 has failed. Error: &quot;Connection refused: no further information. Verify the connection properties. Make sure that an instance of SQL Server is running on the host and accepting TCP/IP connections at the port. Make sure that TCP connections to the port are not blocked by a firewall.&quot;.
      at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(SQLServerException.java:237)
      at com.microsoft.sqlserver.jdbc.SQLServerException.ConvertConnectExceptionToSQLServerException(SQLServerException.java:288)
      at com.microsoft.sqlserver.jdbc.SocketFinder.findSocket(IOBuffer.java:2466)
      at com.microsoft.sqlserver.jdbc.TDSChannel.open(IOBuffer.java:676)
      at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(SQLServerConnection.java:2957)
      at com.microsoft.sqlserver.jdbc.SQLServerConnection.login(SQLServerConnection.java:2628)
      at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectInternal(SQLServerConnection.java:2471)
      at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(SQLServerConnection.java:1470)
      at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(SQLServerDriver.java:915)
      at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:138)
      at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:364)
      at com.zaxxer.hikari.pool.PoolBase.newPoolEntry(PoolBase.java:206)
      at com.zaxxer.hikari.pool.HikariPool.createPoolEntry(HikariPool.java:476)
      at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:561)
      ... 53 more
  
  Process finished with exit code 1
  </code></pre>
  <p>I would like to be able to catch something as &quot;simple&quot; as the database being unavailable, log a <em>single</em> line of text reporting that, and then close down the application gracefully (e.g., <code>SpringApplication.exit()</code>). As of yet, I have failed. I have tried catching the <code>SQLServerException</code>, <code>UnsatisfiedDependencyException</code>, <code>BeanInstantiationException</code>, <code>HikariPool.PoolInitializationException</code>, etc. in <em><code>DatabaseConfiguration</code></em>, <em><code>ConfigureDataSource</code></em> and <em><code>Application</code></em> but they still bubble up through <code>app.run(args)</code>.</p>
  <p><strong>How can I catch the <code>BeanInstantiationException</code> or <code>HikariPool.PoolInitializationException</code> and properly handle and log this kind of problem?</strong> I'm assuming I need to override some part of the DataSource bean initialization, but have not been able to locate it. (Every Stack Overflow post focuses on <em>eliminating</em> the exception rather than logging it.)</p>