I'm trying to use a onUploadException event listener to catch failed uploads and report the error as a validation error after the page reloads. I have access to the error when the page reloads, but I don't know how to report the error as it is not clear how to report an error to the validation tracker outside of a validation event.
Here is what I have at the moment, the setup render fails because the validation tracker isn't yet available. @Environmental private ValidationTracker tracker; @SetupRender public void setupRender() { tracker.recordError(errorMessageService.getErrorMessageDescriptionText(exception) } @Persist(PersistenceConstants.FLASH) @Property private TotalUploadTooLargeException errMessage; @OnEvent(UploadEvents.UPLOAD_EXCEPTION) Object onUploadException(FileUploadException ex) throws TotalUploadTooLargeException { errMessage = new TotalUploadTooLargeException(1, 1, ex); return this; }