1
0
Fork 0
freesewing/markdown/dev/reference/api/part/raise/warning/en.md
2022-02-19 08:04:25 +01:00

1 KiB

title
Part.raise.warning()

A part's raise.warning() method will log a warning-level event. Warning events are typically used to pass information to pattern developers so that can troubleshoot issues with the pattern, or users to warn them that something is sub-optimal.

What happens with this data is entirely up to the frontend developer. As such, data can by anything you like. A string is common, but you can also add arrays or objects with data or information you want to use in your frontend.

All raise methods are available via the shorthand method

Part.raise.warning() signature

raise.warning(data)

Part.raise.warning() example

export default function (part) {
  const { raise, measurements } = part.shorthand()

  if (measurements.hips > measurements.chest) {
    raise.warning(`
      Chest circumference is smaller than hip circumference. 
      This might lead to unexpected results
    `)
  } 

  // You would do more useful stuff before returning
  return part
}