mirror of
https://github.com/xodio/xod.git
synced 2026-03-24 17:46:56 +01:00
fix(xod-arduino, xod-client): add missing formatter for error about too many outputs
Closes #1545
This commit is contained in:
@@ -5,3 +5,5 @@ export {
|
||||
getNodeIdsMap,
|
||||
getRequireUrls,
|
||||
} from './transpiler';
|
||||
|
||||
export { default as messages } from './messages';
|
||||
|
||||
10
packages/xod-arduino/src/messages.js
Normal file
10
packages/xod-arduino/src/messages.js
Normal file
@@ -0,0 +1,10 @@
|
||||
// Stanza creators.
|
||||
// See `xod-func-tools` package Stanza type
|
||||
export default {
|
||||
TOO_MANY_OUTPUTS_FOR_NATIVE_NODE: ({ patchPath }) => ({
|
||||
title: 'Too many outputs',
|
||||
note: `C++ node ${patchPath} has more than 7 outputs. This is a limit for nodes implemented natively.`,
|
||||
solution:
|
||||
'Try to express the node as a XOD patch node composed of smaller C++ nodes or group the outputs into a new custom type.',
|
||||
}),
|
||||
};
|
||||
@@ -7,6 +7,7 @@ import {
|
||||
maybeProp,
|
||||
foldEither,
|
||||
isAmong,
|
||||
fail,
|
||||
} from 'xod-func-tools';
|
||||
import * as XP from 'xod-project';
|
||||
import { def } from './types';
|
||||
@@ -425,13 +426,9 @@ const checkForNativePatchesWithTooManyOutputs = def(
|
||||
);
|
||||
|
||||
if (nodeWithTooManyOutputs) {
|
||||
return Either.Left(
|
||||
new Error(
|
||||
`Native node ${
|
||||
nodeWithTooManyOutputs.patchPath
|
||||
} has more than 7 outputs`
|
||||
)
|
||||
);
|
||||
return fail('TOO_MANY_OUTPUTS_FOR_NATIVE_NODE', {
|
||||
patchPath: nodeWithTooManyOutputs.patchPath,
|
||||
});
|
||||
}
|
||||
|
||||
return Either.of(tProject);
|
||||
|
||||
@@ -57,8 +57,10 @@ describe('xod-arduino transpiler', () => {
|
||||
.then(
|
||||
foldEither(
|
||||
err => {
|
||||
assert.include(err.message, '@/too-many-outputs');
|
||||
assert.include(err.message, 'has more than 7 outputs');
|
||||
assert.strictEqual(
|
||||
err.message,
|
||||
'TOO_MANY_OUTPUTS_FOR_NATIVE_NODE {"patchPath":"@/too-many-outputs"}'
|
||||
);
|
||||
},
|
||||
() => assert(false, 'expecting Either.Left')
|
||||
)
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
import { composeErrorFormatters } from 'xod-func-tools';
|
||||
import { messages as xpMessages } from 'xod-project';
|
||||
import { messages as xardMessages } from 'xod-arduino';
|
||||
|
||||
import formatUnexpectedError from '../messages/formatUnexpectedError';
|
||||
|
||||
export default composeErrorFormatters([
|
||||
xpMessages,
|
||||
xardMessages,
|
||||
{
|
||||
UNEXPECTED_ERROR: formatUnexpectedError,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user