terrastruct / d2-playground

An online runner to play, learn, and create with D2, the modern diagram scripting language that turns text to diagrams.
https://play.d2lang.com
Mozilla Public License 2.0
73 stars 10 forks source link

surface better error messages #35

Open WayneCui opened 1 year ago

WayneCui commented 1 year ago

https://play.d2lang.com/?script=nJTBTttMEMfvfop9AcTdh-_wtcdyqHqtVJlgrKjBLglUQlUkqHAwIYHQUIeSBnBaRCglQUJgEkzyMDDr9SmvUHnHsZwaA-qFCO9_Zv7zm9kNxyuSrI9TSGnqbFoRCbSb1LDd0w47_gGFC2p2qWXQ2hX0tqDeJ58EQjgSkeTk-UVZTcnvZtKSkpXmBEJSmbSsLoySCIRIiiKSF362lT2oGJ51yVWylBUJ7a_Sax0_5bTMIrqJlsWzaSn1XlZnRAKVTfe0Q7-XoWgJhMwt5eYzIplaevP6lf-vpiqaSKb8n5f_C4RktKwsEvfgiHUK0KuGce5Oixo2W_sFxROs5tXaXnNX5M2NmiAT_6F7NqiDfhT6Hzolb3mdbpxgEI-QFMWXh0YnU5o6k_b7mRg1xnWBIEyNKUIObv0a9AtPL7u37WjegBezL9jt7yi1qNdA5H7uwtoN6Pb9bTXikJ8-yyPoRlCCR0OhzDZt2DKjcxmR-hdWsa4GdWaV_iLBlXn-l5rn0Nxnx6tgfHvKw6yW5b1FY2hp3fvSHjol1q_63vBjw7q_uRo6JWrfQPEwmhcKOrS7QWpMiG5xs--WK9Q8X5Cm75a336pssAP1fQx0HZP1tz3r0ms0k51tmFBsoXSsavfqftCAs91Y4XBgeB4NCrSRrQquxFhm_Qh61UDKz8eyYgdxvK5juocr8QqjRp4VF8eHTVCjAsUDfzs4LX4VW_7q185ik59EWMHdwDXZbLFy5bEFwFmHV991TNiyk9FSX9hEOeuUacOKN46vCSrHNP7BA0jD4kkJx0k-LI8DpLt992dvHM3eaiQoL_AfBI28hs7eY7DwyQgmw29LMqnJnPRRnviQ1aYz8lz4cOTkhcRdpF_Pabn9xBZG1yKZ1AOqOCB8JaG-H7xfRo1ZrXCr8kJe-BMAAP__&

bo-ku-ra commented 1 year ago

cause shape: sequence_diagram

alixander commented 1 year ago

it should still work with sequence_diagram though. we'll look into it

ejulio-ts commented 1 year ago

@WayneCui you are missing an entry for forend. As far as I remember, we don't allow defining nested actors, they must be defined upfront, to avoid ambiguity. So, just adding frond: something below should compile

config: 客户端解决方案时序图 {
  shape: sequence_diagram
  client: 客户
  agg: C端聚合页
  clear: 澄清页
  solution: 解决方案页
  backend: 后端服务
  mysql: MySQL
  mongo: MongoDB
  lore: 知识库服务

here is where you use it

新增规则解决方案: {
      client -> forend: 新增规则按钮,输入规则条件,添加解决方案内容
      forend -> client: 【新tab】\n返回方案编辑页面
      client -> forend: 拖动编辑解决方案并保存
      forend -> backend: 保存解决方案
      backend -> mysql: 解决方案入库
      mysql -> backend: 返回规则解决方案编码
      backend -> forend: 返回规则解决方案编码
      forend -> client: 保存成功,页面自动关闭
    }
ejulio-ts commented 1 year ago

Anyway, I think our playground message could be better image

While the console output was

err: failed to compile: could not find center of forend. Is it declared as an actor?
exit status 1