<commit_before>export default function target(model, view) {
  model.attributeChanges.when('target', (vNode) => {
    const [x, y] = vNode.properties.target
      .split(',')
      .map(Number)
    ;
    view.viewBoxTransformations.emit('update', {
      priority: 10,
      transformFunction: (coords) => [
        coords[0] + x,
        coords[1] + y,
        coords[2],
        coords[3]
      ]
    });
  });
}<commit_msg>Better error handling in the target plugin<commit_after>const proto = {
  priority: 10
};

export default function target(model, view) {
  model.attributeChanges.when('target', (vNode) => {
    const [x, y] = vNode.properties.target
      .split(',')
      .map(Number)
    ;
    const update = Object.create(proto);
    const {emit} = view.viewBoxTransformations;

    if (![x, y].every(Number.isFinite)) {
      emit('error', new Error(
        'drawingBoard.target: The <drawing-board> attribute `target` should ' +
        'match the form "`{Number} x`, `{Number} y`".'
      ));
      emit('update', Object.assign(update, {transformFunction: null}));
    }

    else emit('update', Object.assign(update, {
      transformFunction: (coords) => [
        coords[0] + x,
        coords[1] + y,
        coords[2],
        coords[3]
      ]
    }));
  });
}
{'fraction_non_alphanumeric': 0.1652377240841777, 'fraction_numerical': 0.009353078721745909, 'mean_word_length': 2.566666666666667, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1274765', 'n_tokens_mistral': 428, 'n_tokens_neox': 419, 'n_words': 87}