<commit_before>import React, { Component } from 'react'
import {Icon} from '@conveyal/woonerf'
import { Button, Alert, Checkbox, ButtonToolbar, FormGroup, Form, FormControl, ControlLabel } from 'react-bootstrap'
import { sentence as toSentenceCase } from 'change-case'
import Rcslider from 'rc-slider'

import { polyline as getPolyline } from '../../../scenario-editor/utils/valhalla'
import { CLICK_OPTIONS } from '../../util'

export default class EditShapePanel extends Component {
  async drawPatternFromStops (pattern, stops) {
    let newShape = await getPolyline(stops)
    console.log(newShape)
    this.props.updateActiveEntity(pattern, 'trippattern', {shape: {type: 'LineString', coordinates: newShape}})
    this.props.saveActiveEntity('trippattern')
    return true<commit_msg>catch error if pattern drawing fails<commit_after>import React, { Component } from 'react'
import {Icon} from '@conveyal/woonerf'
import { Button, Alert, Checkbox, ButtonToolbar, FormGroup, Form, FormControl, ControlLabel } from 'react-bootstrap'
import { sentence as toSentenceCase } from 'change-case'
import Rcslider from 'rc-slider'

import { polyline as getPolyline } from '../../../scenario-editor/utils/valhalla'
import { CLICK_OPTIONS } from '../../util'

export default class EditShapePanel extends Component {
  async drawPatternFromStops (pattern, stops) {
    let newShape = await getPolyline(stops)
    if (newShape) {
      this.props.updateActiveEntity(pattern, 'trippattern', {shape: {type: 'LineString', coordinates: newShape}})
      this.props.saveActiveEntity('trippattern')
      return true
    } else {
      this.props.setErrorMessage('Error drawing pattern from stops! Some stops may be unreachable by streets.')
      return false
    }
{'fraction_non_alphanumeric': 0.11479154768703598, 'fraction_numerical': 0.0, 'mean_word_length': 4.651612903225806, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '2766736', 'n_tokens_mistral': 504, 'n_tokens_neox': 501, 'n_words': 150}