diff --git a/src/core/plugins/download-url.js b/src/core/plugins/download-url.js index d80e982b171c7ca701dfb74ed769183ba0287f39..d337c7117d53f11f3f25f2fe21af1769b5f55302 100644 --- a/src/core/plugins/download-url.js +++ b/src/core/plugins/download-url.js @@ -26,7 +26,7 @@ export default function downloadUrlPlugin (toolbox) { function next(res) { if(res instanceof Error || res.status >= 400) { specActions.updateLoadingStatus("failed") - return errActions.newThrownErr( new Error(res.statusText + " " + url) ) + return errActions.newThrownErr( new Error((res.message || res.statusText) + " " + url) ) } specActions.updateLoadingStatus("success") specActions.updateSpec(res.text) diff --git a/src/core/plugins/err/actions.js b/src/core/plugins/err/actions.js index 40fd1121b38e59f8dbb81290a9385115dd7d4b63..461971cddc2daa4b67445d00cd044d174384a289 100644 --- a/src/core/plugins/err/actions.js +++ b/src/core/plugins/err/actions.js @@ -7,10 +7,10 @@ export const NEW_SPEC_ERR_BATCH = "err_new_spec_err_batch" export const NEW_AUTH_ERR = "err_new_auth_err" export const CLEAR = "err_clear" -export function newThrownErr(err, action) { +export function newThrownErr(err) { return { type: NEW_THROWN_ERR, - payload: { action, error: serializeError(err) } + payload: serializeError(err) } } diff --git a/src/core/system.js b/src/core/system.js index b7b70f197f84c1cde23870cddf28276f9d9e5dd5..824bc558f15b62cb29a2a815f4ca30438a510335 100644 --- a/src/core/system.js +++ b/src/core/system.js @@ -18,7 +18,6 @@ function createStoreWithMiddleware(rootReducer, initialState, getSystem) { // createLogger( { // stateTransformer: state => state && state.toJS() // } ), - // errorLog(getSystem), Need to properly handle errors that occur during a render. Ie: let them be... systemThunkMiddleware( getSystem ) ] diff --git a/src/core/utils.js b/src/core/utils.js index a809b343ddaf046c22bb83583417ae88e7e94c90..2b084ba4efd25405fab32459fba618d8f5c3e4ef 100644 --- a/src/core/utils.js +++ b/src/core/utils.js @@ -126,15 +126,6 @@ export function systemThunkMiddleware(getSystem) { } } -export const errorLog = getSystem => () => next => action => { - try{ - next( action ) - } - catch( e ) { - getSystem().errActions.newThrownErr( e, action ) - } -} - export function defaultStatusCode ( responses ) { let codes = responses.keySeq() return codes.contains(DEFAULT_REPONSE_KEY) ? DEFAULT_REPONSE_KEY : codes.filter( key => (key+"")[0] === "2").sort().first() diff --git a/src/standalone/layout.jsx b/src/standalone/layout.jsx index 30e46ccc21e2acc726b3721d16944445427f4620..a3a7d98ce75812283f0d5b107186b83fc0e3c43b 100644 --- a/src/standalone/layout.jsx +++ b/src/standalone/layout.jsx @@ -16,7 +16,7 @@ export default class StandaloneLayout extends React.Component { } render() { - let { getComponent, specSelectors } = this.props + let { getComponent, specSelectors, errSelectors } = this.props let Container = getComponent("Container") let Row = getComponent("Row") @@ -27,6 +27,8 @@ export default class StandaloneLayout extends React.Component { const OnlineValidatorBadge = getComponent("onlineValidatorBadge", true) const loadingStatus = specSelectors.loadingStatus() + const lastErr = errSelectors.lastError() + const lastErrMsg = lastErr ? lastErr.get("message") : "" return ( @@ -43,12 +45,16 @@ export default class StandaloneLayout extends React.Component {
{lastErrMsg}
+{lastErrMsg}
+