Interface ServiceExceptionUtils


public interface ServiceExceptionUtils
Helper methods for creating (localized) messages in ServiceException.

ServiceExceptionUtils#getMessage is used to implement ServiceException#getMessage and ServiceExceptionUtils#getLocalizedMessage is used to implement ServiceException#getLocalizedMessage respectively.

  • Method Details

    • getMessage

      String getMessage(String code, Object[] args)
      Creates a message based on code and args. code may either be a SL4J-message format or a bundle key. The JVM's default locale is taken to lookup code in resource bundles.
      Parameters:
      code - The used code
      args - The arguments for message formats.
      Returns:
      The created message
    • getLocalizedMessage

      @Deprecated(forRemoval=true) default String getLocalizedMessage(String code, Object[] args, Locale locale)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Creates a message based on code and args. code may either be a SL4J-message format or a bundle key. The specified locale is taken to lookup the code in resource bundles. If the specified locale is null the locale provided of the current RequestContext is used
      Parameters:
      code - The used code
      args - The arguments for message formats.
      locale - The locale
      Returns:
      The created message
    • getLocalizedMessage

      String getLocalizedMessage(String code, Object[] args, Locale locale, boolean errorStatusFallback)
      Creates a message based on code and args. code may either be a SL4J-message format or a bundle key. The specified locale is taken to lookup the code in resource bundles. If the specified locale is null the locale provided of the current RequestContext is used
      Parameters:
      code - The used code
      args - The arguments for message formats.
      locale - The locale
      errorStatusFallback - If true, a fallback to the description is done for well-known ErrorStatus.
      Returns:
      The created message
    • getMessageTarget

      @Deprecated(forRemoval=true) default MessageTarget getMessageTarget(String target)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Parameters:
      target -
      Returns:
    • getMessageTarget

      @Deprecated(forRemoval=true) default MessageTarget getMessageTarget(String parameter, Function<com.sap.cds.ql.StructuredType<?>,Object> path)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Parameters:
      parameter -
      path -
      Returns:
    • getMessageTarget

      @Deprecated(forRemoval=true) default <E extends com.sap.cds.ql.StructuredType<E>> MessageTarget getMessageTarget(String parameter, Class<E> type, Function<E,Object> path)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Type Parameters:
      E -
      Parameters:
      parameter -
      type -
      path -
      Returns:
    • getMessageTarget

      @Deprecated(forRemoval=true) default MessageTarget getMessageTarget(com.sap.cds.ql.cqn.Path path, com.sap.cds.reflect.CdsElement element)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Parameters:
      path -
      element -
      Returns:
    • getErrorsProperties

      CdsProperties.Errors getErrorsProperties()
      Returns:
      the active CdsProperties.Errors properties