diff --git a/src/components/Questions/QuestionFile.vue b/src/components/Questions/QuestionFile.vue index 0e6200182..d15a391aa 100644 --- a/src/components/Questions/QuestionFile.vue +++ b/src/components/Questions/QuestionFile.vue @@ -387,28 +387,35 @@ export default defineComponent({ }) } catch (error) { logger.error('Error while submitting the form', { error }) - showError( - t( - 'forms', - 'There was an error during submitting the file: {message}.', - { - message: - ( - error as { - response?: { - data?: { - ocs?: { - meta?: { - message?: string - } - } - } - } - } - ).response?.data?.ocs?.meta?.message ?? '', - }, - ), - ) + const errorResponse = ( + error as { + response?: { + status?: number + data?: { ocs?: { meta?: { message?: string } } } + } + } + ).response + const message = errorResponse?.data?.ocs?.meta?.message + if (errorResponse?.status === 429) { + showError( + t( + 'forms', + 'Too many submissions. Please wait a minute and try again.', + ), + ) + } else if (message) { + showError( + t( + 'forms', + 'There was an error during submitting the file: {message}.', + { message }, + ), + ) + } else { + showError( + t('forms', 'There was an error during submitting the file.'), + ) + } return } finally { diff --git a/src/views/Submit.vue b/src/views/Submit.vue index ca08a9a1f..ce5565fad 100644 --- a/src/views/Submit.vue +++ b/src/views/Submit.vue @@ -1110,15 +1110,24 @@ export default defineComponent({ deleteFormFieldFromLocalStorage() emitEvent('forms:last-updated:set', props.form.id) } catch (error) { - const errorMessage = ( + const response = ( error as { response?: { + status?: number data?: { ocs?: { meta?: { message?: string } } } } } - ).response?.data?.ocs?.meta?.message + ).response + const errorMessage = response?.data?.ocs?.meta?.message logger.error('Error while submitting the form', { error }) - if (errorMessage) { + if (response?.status === 429) { + showError( + t( + 'forms', + 'Too many submissions. Please wait a minute and try again.', + ), + ) + } else if (errorMessage) { showError( t( 'forms',