Class ErrorMessageCache


  • public class ErrorMessageCache
    extends Object
    A thread-safe way of capturing errors for a given transaction for error-handling purposes across threads. (Basically so we can still throw meaningful errors back to API calls even though the back-end processing happens in a different thread, asynchronously, from the API call itself.)
    • Constructor Detail

      • ErrorMessageCache

        public ErrorMessageCache()
    • Method Detail

      • add

        public static Exception add​(Long txId,
                                    Exception error)
        Add an error for a given transaction.
        Parameters:
        txId - transaction for which to add the error
        error - error to record
        Returns:
        Exception error that was added
      • get

        public static Exception get​(Long txId)
        Retrieve any error for the given transaction.
        Parameters:
        txId - transaction for which to retrieve error
        Returns:
        Exception if there was any error, or null if there was no error