diff --git a/client/instanceProxyHandler.js b/client/instanceProxyHandler.js index f8f16647..fb8d9d2d 100644 --- a/client/instanceProxyHandler.js +++ b/client/instanceProxyHandler.js @@ -20,7 +20,11 @@ const instanceProxyHandler = { try { result = target[name].call(proxy, scopedContext) } catch (error) { - context.catch && context.catch(error) + if (context.catch) { + context.catch(error) + } else { + throw error + } return null } if (result instanceof Promise) { diff --git a/loaders/add-source-to-node.js b/loaders/add-source-to-node.js index 435306c6..c92bd5a0 100644 --- a/loaders/add-source-to-node.js +++ b/loaders/add-source-to-node.js @@ -13,7 +13,9 @@ module.exports = function (source) { if (path.parent.type === 'JSXAttribute') { if (path.node.name.startsWith('on')) { const element = path.findParent((p) => p.type === 'JSXOpeningElement' && p.node.attributes) - const hasSource = element.node.attributes.find((a) => a.name.name === 'source') + const hasSource = element.node.attributes.find((a) => { + return a.type === 'JSXAttribute' && a.name.name === 'source' + }) if (!hasSource) { const start = element.node.attributes[0].start uniquePositions.add(start) diff --git a/server/printError.js b/server/printError.js index c375cf76..4fbd51d4 100644 --- a/server/printError.js +++ b/server/printError.js @@ -1,7 +1,9 @@ import context from './context' export default function (error) { - context.catch && context.catch(error) + if (context.catch) { + context.catch(error) + } const lines = error.stack.split(`\n`) let initiator = lines.find((line) => line.indexOf('Proxy') > -1) if (initiator) { diff --git a/tests/src/RenderableComponent.njs b/tests/src/RenderableComponent.njs index d469e803..59a00f25 100644 --- a/tests/src/RenderableComponent.njs +++ b/tests/src/RenderableComponent.njs @@ -28,6 +28,7 @@ class RenderableComponent extends Nullstack { render({ params }) { const list = params.shortList ? [1, 2, 3] : [1, 2, 3, 4, 5, 6] const html = ' Nullstack ' + const props = { disabled: true, 'aria-label': 'props' } return (