From: Daniel Karbach Date: Wed, 15 Feb 2023 10:36:47 +0000 (+0100) Subject: improved error reporting X-Git-Url: https://git.localhorst.tv/?a=commitdiff_plain;h=d7563cd775e2e07bf9d479fece757433533e0ecf;p=alttp.git improved error reporting --- diff --git a/resources/js/components/common/ErrorBoundary.js b/resources/js/components/common/ErrorBoundary.js index 4fbc562..83fdb3e 100644 --- a/resources/js/components/common/ErrorBoundary.js +++ b/resources/js/components/common/ErrorBoundary.js @@ -1,6 +1,8 @@ import PropTypes from 'prop-types'; import React from 'react'; +import ErrorMessage from './ErrorMessage'; + class ErrorBoundary extends React.Component { constructor(props) { super(props); @@ -21,7 +23,7 @@ class ErrorBoundary extends React.Component { const { children } = this.props; const { error } = this.state; if (error) { - return

error

; + return ; } return children; } diff --git a/resources/js/components/common/ErrorMessage.js b/resources/js/components/common/ErrorMessage.js index 8829de7..2430bc2 100644 --- a/resources/js/components/common/ErrorMessage.js +++ b/resources/js/components/common/ErrorMessage.js @@ -12,6 +12,12 @@ const ErrorMessage = ({ error }) => {

{i18n.t(`error.${error.response.status}.description`)}

; } + if (error.message) { + return + Error +

{error.message}

+
; + } return
Error
; };