Class CosmosExceptionUtils


  • public class CosmosExceptionUtils
    extends Object
    To handle and throw a cosmos db exception when access the database
    • Constructor Detail

      • CosmosExceptionUtils

        public CosmosExceptionUtils()
    • Method Detail

      • exceptionHandler

        public static <T> Mono<T> exceptionHandler​(String message,
                                                   Throwable throwable,
                                                   ResponseDiagnosticsProcessor responseDiagnosticsProcessor)
        To throw a CosmosDBAccessException
        Type Parameters:
        T - type class of Mono
        Parameters:
        message - the detail message
        throwable - exception
        responseDiagnosticsProcessor - response diagnostics processor
        Returns:
        Mono instance
        Throws:
        CosmosAccessException - for operations on cosmos db
      • findAPIExceptionHandler

        public static <T> Mono<T> findAPIExceptionHandler​(String message,
                                                          Throwable throwable,
                                                          ResponseDiagnosticsProcessor responseDiagnosticsProcessor)
        To find an exceptionHandler for a exception and return empty Mono if the exception status code is not found
        Type Parameters:
        T - type class of Mono
        Parameters:
        message - the detail message
        throwable - exception
        responseDiagnosticsProcessor - Response Diagnostics Processor
        Returns:
        Mono instance
        Throws:
        CosmosAccessException - for operations on cosmos db