How to collect validation errors and custom errors in pipe

I have a pipe in which I want to add errors to the arkerrors array. But when there is an validation error, then only the validation error is outputted.
const pipedType = type({foo: 'string', bar: 'number'}).pipe((t, ctx) => {
  if (t.foo === 'foo') {
    ctx.error({
      data: 'foo',
      expected: 'bar',
      message: 'baz',
      code: 'predicate',
      path: ['foo']
    });
    return ctx.errors;
  }
  return t;
});

When I have now the following type, only the validation error is shown:
const foo = {
  foo: 'foo',
  bar: 'bar',
};

But I want that both errors are returned, so that I can return all collected errors.
Was this page helpful?